error after updating the Xcode to 7.0

后端 未结 1 1271
走了就别回头了
走了就别回头了 2020-12-22 00:45

I\'m developing an iOS application in Swift. When I updated the Xcode to 7.0, I\'m getting error in swiftyJSON.

 static func fromObject(object: AnyObject) -&         


        
相关标签:
1条回答
  • 2020-12-22 01:12
     for (k:AnyObject, v:AnyObject) in value { .. }
    

    must be written in Swift 2 as

    for (k, v) : (AnyObject, AnyObject) in value { .. }
    

    From the Xcode 7 release notes:

    Type annotations are no longer allowed in patterns and are considered part of the outlying declaration. This means that code previously written as:

    var (a : Int, b : Float) = foo()
    

    needs to be written as:

    var (a,b) : (Int, Float) = foo()
    

    if an explicit type annotation is needed. The former syntax was ambiguous with tuple element labels.

    But in your case the explicit annotation is actually not needed at all:

    for (k, v) in value { .. }
    

    because NSDictionary.Generator is already defined as a generator returning (key: AnyObject, value: AnyObject) elements.

    0 讨论(0)
提交回复
热议问题