-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
669 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Presentation/Presentation/Resources/Images.xcassets/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Presentation/Presentation/Resources/Images.xcassets/WordleGuideImage.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "WordleGuideImage.png", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+70.6 KB
...tation/Resources/Images.xcassets/WordleGuideImage.imageset/WordleGuideImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Presentation/Presentation/Sources/Wordle/Model/KeyboardState.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// KeyboardState.swift | ||
// Presentation | ||
// | ||
// Created by 최정인 on 11/26/24. | ||
// | ||
|
||
enum KeyboardState { | ||
case unused | ||
case wrong | ||
case correct | ||
case misplaced | ||
case enter | ||
case erase | ||
} |
11 changes: 11 additions & 0 deletions
11
Presentation/Presentation/Sources/Wordle/Model/Wordle.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// Wordle.swift | ||
// Presentation | ||
// | ||
// Created by 최정인 on 11/26/24. | ||
// | ||
|
||
struct Wordle { | ||
var alphabet: String? | ||
var state: WordleState | ||
} |
11 changes: 11 additions & 0 deletions
11
Presentation/Presentation/Sources/Wordle/Model/WordleKeyboard.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// WordleKeyboard.swift | ||
// Presentation | ||
// | ||
// Created by 최정인 on 11/26/24. | ||
// | ||
|
||
struct WordleKeyboard { | ||
let alphabet: String? | ||
var keyboardState: KeyboardState | ||
} |
15 changes: 15 additions & 0 deletions
15
Presentation/Presentation/Sources/Wordle/Model/WordleState.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// WordleState.swift | ||
// Presentation | ||
// | ||
// Created by 최정인 on 11/26/24. | ||
// | ||
|
||
enum WordleState { | ||
case empty | ||
case typing | ||
case wrong | ||
case correct | ||
case invalid | ||
case misplaced | ||
} |
68 changes: 68 additions & 0 deletions
68
Presentation/Presentation/Sources/Wordle/View/KeyboardTileView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// | ||
// KeyboardTileView.swift | ||
// Presentation | ||
// | ||
// Created by 최정인 on 11/26/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct KeyboardTileView: View { | ||
@Binding var wordleKeyboard: WordleKeyboard | ||
let keyboardWidth: CGFloat | ||
let keyboardHeight: CGFloat | ||
let action: () -> Void | ||
|
||
private enum KeyboardTileViewLayoutConstant { | ||
static let keyboardCornerRadius: CGFloat = 10 | ||
static let enterFontSize: CGFloat = 13 | ||
} | ||
|
||
// 타일 색상 | ||
private var keywordColor: Color { | ||
switch wordleKeyboard.keyboardState { | ||
case .unused, .enter, .erase: | ||
.gray200 | ||
case .wrong: | ||
.gray600 | ||
case .correct: | ||
.airplainBlue | ||
case .misplaced: | ||
.wordleYellow | ||
} | ||
} | ||
|
||
// Text 색상 | ||
private var keyboardTextColor: Color { | ||
switch wordleKeyboard.keyboardState { | ||
case .unused, .enter, .erase: | ||
.airplainBlack | ||
default: | ||
.white | ||
} | ||
} | ||
|
||
var body: some View { | ||
Button(action: action) { | ||
ZStack { | ||
RoundedRectangle(cornerRadius: KeyboardTileViewLayoutConstant.keyboardCornerRadius) | ||
.fill(keywordColor) | ||
.frame(width: keyboardWidth, height: keyboardHeight) | ||
|
||
if let alphabet = wordleKeyboard.alphabet { | ||
Text(alphabet) | ||
.font(Font(AirplainFont.Heading3)) | ||
.foregroundStyle(keyboardTextColor) | ||
} else if wordleKeyboard.keyboardState == .erase { | ||
Text("⌫") | ||
.font(Font(AirplainFont.Heading3)) | ||
.foregroundStyle(keyboardTextColor) | ||
} else if wordleKeyboard.keyboardState == .enter { | ||
Text("ENTER") | ||
.font(.system(size: KeyboardTileViewLayoutConstant.enterFontSize, weight: .bold)) | ||
.foregroundStyle(keyboardTextColor) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.