我的心情小記 - Mood Journal App
Published in
Dec 5, 2021
GitHub 連結
Demo 影片
基本需求
- 畫面上至少需包含以下元件,而且程式也有使用這些元件。
Text,Image,Button,Date Picker,Form,Picker,Slider,TextField,TextEditor,Toggle,Stepper。
- Image & Text
- Button & Toggle & Date Picker
- Form & Picker & Stepper & TextField & TextEditor
- Slider
- 使用到 SwiftUI 的 @State & @Binding。
- 使用到亂數。
- 利用 DisclosureGroup 控制 Form 裡有些欄位顯示 / 隱藏。
- 顯示 Alert。
- 利用 function sheet & fullScreenCover 切換頁面。
- 使用 ColorPicker 選顏色。
加分功能
- 使用 iOS 15 的 FocusState 收鍵盤。
- 使用 onChange modifier。
- 使用 confirmationDialog。(舊版請使用 actionSheet)
- 顯示 ContextMenu。
- 地圖。
其他功能
- 資料儲存/讀取/刪除。
- Search。
- 表單標籤的 View Modifier。
- 音樂循環播放/換歌/隨機播放。
- 更改 Form table 顏色。
struct ContentView: View {
init() {
// 先清空 table 的預設背景顏色
UITableView.appearance().backgroundColor = .clear
}
}
----------------------------------------------------------------
Form {
...
}
// form 背景顏色設為底色再深一些的顏色 .background(optionViewModel.background.color.brightness(-0.12)) .cornerRadius(30)
.padding()