-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix: 기록하기 뷰 에러 해결
- Loading branch information
Showing
8 changed files
with
129 additions
and
67 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
24 changes: 24 additions & 0 deletions
24
Projects/App/Sources/DesignSystem/DismissKeyBoard/DismissKeyboard.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,24 @@ | ||
// | ||
// DismissKeyBoard.swift | ||
// SYM | ||
// | ||
// Created by 민근의 mac on 3/4/24. | ||
// Copyright © 2024 Mogong. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct DismissKeyboard: ViewModifier { | ||
func body(content: Content) -> some View { | ||
content | ||
.onTapGesture { | ||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) | ||
} | ||
} | ||
} | ||
|
||
extension View { | ||
func dismissKeyboardOnTap() -> some View { | ||
modifier(DismissKeyboard()) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Projects/App/Sources/DesignSystem/DismissKeyBoard/DismissKeyboardDemo.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,29 @@ | ||
// | ||
// DismissKeyboardDemo.swift | ||
// SYM | ||
// | ||
// Created by 민근의 mac on 3/4/24. | ||
// Copyright © 2024 Mogong. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct DismissKeyboardDemo: View { | ||
@State private var text: String = "" | ||
|
||
var body: some View { | ||
VStack { | ||
TextField("Type something", text: $text) | ||
.padding() | ||
.textFieldStyle(RoundedBorderTextFieldStyle()) | ||
.dismissKeyboardOnTap() // 이 부분을 통해 사용할 수 있습니다. | ||
|
||
Text("You typed: \(text)") | ||
} | ||
.padding() | ||
} | ||
} | ||
|
||
#Preview { | ||
DismissKeyboardDemo() | ||
} |
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
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 |
---|---|---|
|
@@ -39,6 +39,7 @@ struct SYMApp: App { | |
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
|