Reputation: 438
I use many libraries in my proj with cocoapods. It requires importing this libraries into files where I uses instances of classes from it.
Today I decide to create protocol and one of declared func must return type from imported library:
import SwiftyJSON
protocol ContainsProductsList {
func productsSummaryPrice() -> Int
func productsCount() -> Int
func productsAvailability(date : String) -> Calendar.Availability
func JSON() -> JSON
}
but compiler don't allow me to do this (Use undeclared type 'JSON'). I tried to place protocol in another file which use SwiftyJSON lib, but result was same. Could you explain why this happens? Maybe there is a way to bypass this?
Upvotes: 0
Views: 58
Reputation: 15512
Use proper naming of the method:
protocol ContainsProductsList {
func productsSummaryPrice() -> Int
func productsCount() -> Int
func productsAvailability(date : String) -> Calendar.Availability
func JSONMYFUNCTION() -> JSON
}
Upvotes: 2