Swift 4.0 :
let preIndex = str.range(of: ",")!.lowerBound
let sufIndex = str.range(of: ",")!.upperBound
let first = str.prefix(upTo: preIndex)
let second = str.suffix(from: sufIndex)
self.latitude = first
self.longtitude = second
let preIndex = str.range(of: ",")!.lowerBound
let sufIndex = str.range(of: ",")!.upperBound
let first = str.prefix(upTo: preIndex)
let second = str.suffix(from: sufIndex)
self.latitude = first
self.longtitude = second
2018-01-15
struct MyStruct2{
var name : String = "User"
var age : Int = 0
var myAttributeSet : MyAttributeSet = MyAttributeSet.init(value: "User,0")
mutating func getValue(myAttributeSet:MyAttributeSet) -> Void{
print(myAttributeSet.name)
print(myAttributeSet.age)
}
}
var name : String = "User"
var age : Int = 0
var myAttributeSet : MyAttributeSet = MyAttributeSet.init(value: "User,0")
mutating func getValue(myAttributeSet:MyAttributeSet) -> Void{
print(myAttributeSet.name)
print(myAttributeSet.age)
}
}
2017-11-14