| ... | ... | @@ -15,6 +15,87 @@ import GngKit |
|
|
|
|
|
|
|
## UI
|
|
|
|
|
|
|
|
### Alert / ActionSheet
|
|
|
|
|
|
|
|
AlertとActionSheetも、使い方は同じ。
|
|
|
|
|
|
|
|
```swift
|
|
|
|
// UIViewController内で
|
|
|
|
|
|
|
|
// Alert
|
|
|
|
Alert(title: "タイトル", message: "メッセージ", buttons: [
|
|
|
|
.default("OK") {
|
|
|
|
// ボタンをタップした時
|
|
|
|
self.dismiss(animated: true, completion: nil)
|
|
|
|
},
|
|
|
|
.cancel("キャンセル") // action処理を省略すると、何もしない(UIを閉じるだけ)
|
|
|
|
]).show(from: self) // 画面に表示
|
|
|
|
|
|
|
|
// ActionSheet
|
|
|
|
ActionSheet(title: "タイトル", message: "メッセージ", buttons: [
|
|
|
|
.default("OK") {
|
|
|
|
self.dismiss(animated: true, completion: nil)
|
|
|
|
},
|
|
|
|
.cancel("キャンセル")
|
|
|
|
]).show(from: self)
|
|
|
|
```
|
|
|
|
|
|
|
|
#### エラーポップアップ
|
|
|
|
|
|
|
|
```swift
|
|
|
|
// UIViewController内で
|
|
|
|
|
|
|
|
showError(
|
|
|
|
title: "タイトル",
|
|
|
|
message: ””メッセージ,
|
|
|
|
buttonTitle: "ボタンのテキスト(基本:OK)",
|
|
|
|
focusTo: nil // ボタンをタップした時、カーソルを移動させるView
|
|
|
|
) {
|
|
|
|
// ボタンをタップした時の処理。(focusTo処理の後)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
- エラーメッセージ表示(UIAlert)
|
|
|
|
- エラーメッセージ確認後に、エラーになった入力Viewにカーソルを移動する
|
|
|
|
|
|
|
|
### 画面効果
|
|
|
|
|
|
|
|
#### Fade In/Out
|
|
|
|
画面全体、又は一部に対して、Fade In/Outアニメーションを行う。
|
|
|
|
|
|
|
|
```swift
|
|
|
|
// UIViewController内で
|
|
|
|
|
|
|
|
// 暗い → 明るい
|
|
|
|
fadeOut(
|
|
|
|
alpha: 0.3, // 初期の透明度
|
|
|
|
frame: nil // 対象の領域。nilの場合、画面全体
|
|
|
|
) { _ in
|
|
|
|
// アニメーションが完了した後の処理
|
|
|
|
}
|
|
|
|
|
|
|
|
// 画面全体に対しては、下記のように省略可能
|
|
|
|
fadeOut()
|
|
|
|
```
|
|
|
|
|
|
|
|
`fadeOut()`した、Viewをもとに戻す。
|
|
|
|
```swift
|
|
|
|
fadeIn { _ in
|
|
|
|
// アニメーションが完了した後の処理
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Blur
|
|
|
|
|
|
|
|
```swift
|
|
|
|
Blur(
|
|
|
|
frame: CGRect, // 対象の領域
|
|
|
|
style: .regular // UIBlurEffect.Styleを参照
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
### TableView
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## IO
|
| ... | ... | |