Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructing an object of class type 'Delegate' with a metatype value must use a 'required' initializer #41

Open
Kyle-Ye opened this issue Feb 25, 2024 · 1 comment
Labels
build issue help wanted PR contribution is appreciated platform: Linux

Comments

@Kyle-Ye
Copy link
Member

Kyle-Ye commented Feb 25, 2024

class FallbackDelegateBox<Delegate: NSObject>: AnyFallbackDelegateBox {
    var storage: DelegateStorage
    
    enum DelegateStorage {
        case type(_ type: Delegate.Type)
        case instance(_ delegate: Delegate)
    }
   
    override var delegate: NSObject? {
        switch storage {
        case let .type(type):
            let delegate = type.init() // error: constructing an object of class type 'Delegate' with a metatype value must use a 'required' initializer
            ...
        }
        #endif
    }
}
@Kyle-Ye Kyle-Ye added help wanted PR contribution is appreciated platform: Linux build issue labels Feb 25, 2024
@Kyle-Ye
Copy link
Member Author

Kyle-Ye commented Feb 25, 2024

Tracked upstream via swiftlang/swift#71874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue help wanted PR contribution is appreciated platform: Linux
Projects
None yet
Development

No branches or pull requests

1 participant