Swift: Optional dataSource with return type a struct

Viewed 40

I am trying to create an optional dataSource which will expect to receive a structure. So I did below.

struct Configuration {
    var color = UIColor.grayColor()
    var width: CGFloat = 10
}

@objc protocol CustomDataSource {
   optional func configuration() -> Configuration
}

but as the result type is not Objective-C type so it's throws an error like below.

enter image description here

I don't want to make this dataSource as required but if its been implement then it must return that structure. I can create custom class to do the same. But is it possible by structure?

0 Answers
Related