You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found the following issue when I tried to "hide" several UIView classes behind a common protocol that allows me to set text on them without caring about their real type.
The only workaround I've found was to create a typealias with the protocol and the UIView class, although this should not be required as the protocol is defined to only be applied with UIView instances.
```
import UIKit
protocol HasText where Self: UIView {
func setText(\_ text: String)
}
extension UILabel: HasText {
func setText(\_ text: String) {
self.text = text
}
Additional Detail from JIRA
md5: 47b2167f47e016649d811653a88359e0
duplicates:
Issue Description:
I've found the following issue when I tried to "hide" several UIView classes behind a common protocol that allows me to set text on them without caring about their real type.
The only workaround I've found was to create a typealias with the protocol and the UIView class, although this should not be required as the protocol is defined to only be applied with UIView instances.
```
import UIKit
protocol HasText where Self: UIView {
}
extension UILabel: HasText {
}
class HasTextViewProducer {
}
HasTextViewProducer.safeGet().setText("This does not crash")
HasTextViewProducer.get().setText("Crash!")
```
The text was updated successfully, but these errors were encountered: