Just learning Swift and cannot find a form of this code that compiles without the use of an empty protocol and empty class:
internal protocol JoinStudyEvent: Event where EventData == String { } fileprivate class JoinStudyEventDirector: EventDirector<String>, JoinStudyEvent { } internal class RegistrationView: UIWindow { private let _joinStudyRequestedEventDirector = JoinStudyEventDirector() public var joinStudyRequestedEvent: some JoinStudyEvent { get { _joinStudyRequestedEventDirector } } ... } I would ideally like to type _joinStudyRequestedEventDirector as EventDirector<String> and joinStudyRequestedEvent as Event where EventData == String or similar without the need for explicit names. However I can't seem to find a simpler form than above that the compiler will accept. For reference EventDirector implements Event.
没有评论:
发表评论