Swift3初始化还是要先子类
class User: Avatar {
var level: Int
init(name: String, level: Int) {
self.level = level
super.init(name: name)
}
}
class User: Avatar {
var level: Int
init(name: String, level: Int) {
self.level = level
super.init(name: name)
}
}
2016-12-27
let commaIndex = coor.range(of: ",")!.lowerBound
let firstElement = coor.substring(to: commaIndex)
let secondElement = coor.substring(from: coor.index(after: commaIndex))
latitude = Double(firstElement)!
longitude = Double(secondElement)!
let firstElement = coor.substring(to: commaIndex)
let secondElement = coor.substring(from: coor.index(after: commaIndex))
latitude = Double(firstElement)!
longitude = Double(secondElement)!
2016-12-23
let result = withdraw(amount: 300)
switch result {
case .success(let newBalance):
print("\(newBalance)元剩余")
case .error(let errorMessage):
print(errorMessage)
}
switch result {
case .success(let newBalance):
print("\(newBalance)元剩余")
case .error(let errorMessage):
print(errorMessage)
}
2016-12-22
swift3.0
let commaIndex = coordinateString.range(of: ",")!.lowerBound
let firstElement = coordinateString.substring(to: commaIndex)
let secondElement = coordinateString.substring(from:coordinateString.index(after: commaIndex) )
let commaIndex = coordinateString.range(of: ",")!.lowerBound
let firstElement = coordinateString.substring(to: commaIndex)
let secondElement = coordinateString.substring(from:coordinateString.index(after: commaIndex) )
2016-12-15