问题
I'm having some issues trying to run this code, I found couple examples using the same code but I get compiler error
Undefined symbols for architecture arm64: "ExpSwift.SearchResults.generate () -> Swift.IndexingGenerator<[A]>", referenced from: ExpSwift_Example.ViewController.(viewDidLoad () -> ()).(closure #1).(closure #3) in ViewController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
here is my code class
public final class SearchResults<T> {
var results = [T]();
let total: Int64
required public init?(results: [T], total: Int64) {
self.results = results
self.total = total
}
public func getResults() -> [T] {
return self.results
}
public func getTotal() -> Int64 {
return self.total
}
}
extension SearchResults : SequenceType {
public func generate() -> IndexingGenerator<Array<T>> {
return results.generate()
}
}
and then calling this with Alamofire
ExpSwift.findLocations(["limit":10, "skip":0, "sort":"name"]).then { (locations: SearchResults<Location>) -> Void in
for location:Location in locations{
debugPrint(location.get("name"))
}
}.error { error in
debugPrint(error)
}
回答1:
Looks like is just something with cocoapods or Xcdoe, the solution for me was just update Xcode 8 and download Xcode 7.3 . If I work with Xcode 7.3 fix the issue with the compiler. I try several times to build and after couple times it works.
来源:https://stackoverflow.com/questions/39498274/sequencetype-generator-generic-swift