Press ESC to close

Or check our Popular Categories...

swift

769   Articles
769
[

[教學] Swift Alert 範例

1 Min Read

let alertController = UIAlertController(
title: “提示”,
message: “請輸入價格或數量”,
preferredStyle: .alert)

// 建立[確認]按鈕
let okAction = UIAlertAction(
title: “確認”,
style: .default,
handler: {
(action: UIAlertAction!) -> Void in
print(“按下確認後的動作”)
})

[

[教學] Swift SQLite 範例

1 Min Read

try! db?.run(users.create(ifNotExists: true, block: { (table) in
table.column(id, primaryKey: true)
table.column(price)
table.column(product)
table.column(date)
table.column(amount)
}))

S

Swift 字串擷取 文字擷取

1 Min Read

let helloIndex = cutString.index(cutString.startIndex, offsetBy: 5)
print(String(cutString.suffix(from: helloIndex)))
// -> ” world”
print(String(cutString.prefix(upTo: helloIndex)))
// -> “hello”