Initializer is inaccessable due to 'internal' protection level

前端 未结 2 861
生来不讨喜
生来不讨喜 2021-02-02 04:36

I have some protocols

LoginStrategy

public protocol LoginStrategy {
    func login(_ viewController: UIViewController)
    func getUserI         


        
相关标签:
2条回答
  • 2021-02-02 05:24

    Just add to your FacebookLoginStrategy:

    public init() {}
    

    As long as you do not implement init() explicitly, it is marked as internal by default. You need to overwrite that permission level to be able to instantiate from outside your framework.

    0 讨论(0)
  • 2021-02-02 05:34

    If you are running in to this in code within an XCTestCase, make sure that you have added @testable import My-Awesome-App to the top of your test file.

    0 讨论(0)
提交回复
热议问题