100 days of swiftui: 31
https://www.hackingwithswift.com/100/swiftui/31
guard isNotRootWord(word: word) else {
wordError(title: "Root word is not possible", message: "Use another word")
return
}
guard isLonggerThan3(word: word) else {
wordError(title: "Word is too short", message: "Input the word longer than 3")
return
}
func isNotRootWord(word: String) -> Bool {
!(rootWord == word)
}
func isLonggerThan3(word: String) -> Bool {
word.count > 3
}
코드 파일
https://github.com/treesofgroo/Ios-WordScramble/commit/701e3dbf35584bbc39bfc291a306e9521089c1f2
.toolbar {
Button(action: {
startGame()
}, label: {
Text("New Word")
})
}
코드 파일
https://github.com/treesofgroo/Ios-WordScramble/commit/e1b8f998b6331fca982f5f181efce28edf3af893
usedWords
가 새로운 게임이 시작되어도 값이 남아있는 걸 확인해서, 새로운 게임이 시작될 때 모든 요소를 지워 초기화했다.코드 파일
https://github.com/treesofgroo/Ios-WordScramble/commit/d109245b66de8ef054a63ff7c3d33cdd543508a6