OpenSwiftUIProject / OpenSwiftUI

[WIP] Open source implementation of Apple's SwiftUI.

Home Page:https://swiftpackageindex.com/OpenSwiftUIProject/OpenSwiftUI/main/documentation/openswiftui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Kyle-Ye opened this issue · comments

commented
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
    }
}
commented

Tracked upstream via apple/swift#71874