Array element cannot be bridged to Objective-C

后端 未结 5 1460
庸人自扰
庸人自扰 2020-12-01 14:13

I have this code that creates a view and applies a gradient to it.

import UIKit
import QuartzCore


let rect : CGRect = CGRectMake(0,0,320,100)

var vista :          


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 14:34

    This runtime error can also be triggered if it tries to bridge an array of type [MySwiftProtocol] over to Objective-C.

    The solution is to mark your protocol with @objc:

    @objc protocol MySwiftProtocol {
       // ...
    }
    

提交回复
热议问题