-
Notifications
You must be signed in to change notification settings - Fork 0
Extension function document
์ด์ ํ edited this page Feb 14, 2024
·
5 revisions
extension View {
func dismissKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}extension View {
func modifier<ModifiedContent: View>(
@ViewBuilder body: (_ content: Self) -> ModifiedContent
) -> ModifiedContent {
body(self)
}
}extension Date {
func toYearMonthDay() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
return dateFormatter.string(from: self)
}
}extension String {
func toDate() -> Date? {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
dateFormatter.timeZone = TimeZone(identifier: "UTC")
if let date = dateFormatter.date(from: self) {
return date
} else {
return nil
}
}
}extension SignUpView {
//MARK: - keyboard dismiss method
func dismissKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}
}extension CustomColor {
static func getSignUpInputGray(_ colorMode: ColorScheme) -> Color {
if colorMode == .light {
return Color(red: 244 / 255, green: 244 / 255, blue: 244 / 255)
} else {
return Color(red: 28 / 255, green: 28 / 255, blue: 30 / 255)
}
}
}