SequenceType Generator Generic Swift

寵の児 提交于 2019-12-25 06:12:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!