This file contains hidden or 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
| "use client"; | |
| import classNames from "classnames"; | |
| import {CSSProperties, forwardRef} from "react"; | |
| import { | |
| CommonProps, | |
| ConditionalProps, | |
| DisplayProps, | |
| FlexProps, |
This file contains hidden or 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
| import SwiftUI | |
| public extension View { | |
| @inlinable | |
| func content<Content: View>( | |
| @ViewBuilder content: @escaping (Self) -> Content | |
| ) -> some View { | |
| return content(self) | |
| } |
This file contains hidden or 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
| import Foundation | |
| public enum DateFormatterType: String, CaseIterable { | |
| /// The ISO8601 formatted date "yyyy-MM-dd" i.e. 1997-07-16 | |
| case isoDate = "yyyy-MM-dd" | |
| /// The ISO8601 formatted date and time "yyyy-MM-dd'T'HH:mm" i.e. 1997-07-16T19:20 | |
| case isoDateTime = "yyyy-MM-dd'T'HH:mm" | |
| /// The ISO8601 formatted date, time and sec "yyyy-MM-dd'T'HH:mm:ss" i.e. 1997-07-16T19:20:30 | |
| case isoDateTimeSec = "yyyy-MM-dd'T'HH:mm:ss" | |
| /// The ISO8601 formatted date, time and millisec "yyyy-MM-dd'T'HH:mm:ss.SSSSSS" i.e. 1997-07-16T19:20:30.45+01:00 |
This file contains hidden or 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
| #if canImport(UIKit) | |
| import UIKit | |
| public enum UIApplicationUtil { | |
| public static var scenes: Set<UIScene> { | |
| return UIApplication.shared.connectedScenes | |
| } | |
| public static var windowScene: UIWindowScene? { | |
| return Self.scenes.compactMap({ $0 as? UIWindowScene }).first |
This file contains hidden or 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
| import Foundation | |
| import Moya | |
| // NetRunner 클래스에서 사용. | |
| // 원래 NetRunner는 BaseEndpoint를 준수 받는 Endpoint (e.g. MealEndpoint, AIEndpoint)를 Generic하게 사용하고 있었음. | |
| // 이런 방식으로 하니 각 Endpoint 별로 NetRunner를 만들어야 함. | |
| // | |
| // 이 프로젝트에서는 각 Endpoint 별로 다른 NetRunner를 쓸 필요성을 못 느낌. | |
| // 따라서 NetRunner는 Generic하게 사용하는 오브젝트를 알 필요가 없음. |
This file contains hidden or 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
| import SwiftUI | |
| public extension View { | |
| @ViewBuilder | |
| func onReadSize(_ perform: @escaping (CGSize) -> Void) -> some View { | |
| self.customBackground { | |
| GeometryReader { geometryProxy in | |
| Color.clear | |
| .preference(key: SizePreferenceKey.self, value: geometryProxy.size) | |
| } |
This file contains hidden or 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
| import SwiftUI | |
| import UIKit | |
| public extension View { | |
| func hideKeyboardWhenTap() -> some View { | |
| self.onTapGesture(perform: hideKeyboard) | |
| } | |
| func hideKeyboard() { | |
| UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) |
This file contains hidden or 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
| import SwiftUI | |
| public struct ScrollOffsetPreferenceKey: PreferenceKey { | |
| public static var defaultValue: CGFloat = 0 | |
| public static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { | |
| value += nextValue() | |
| } | |
| } |
This file contains hidden or 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
| import Combine | |
| import SwiftUI | |
| public extension Publisher { | |
| func ignoreError() -> AnyPublisher<Output, Never> { | |
| return self.catch { _ in | |
| Empty<Output, Never>() | |
| } | |
| .eraseToAnyPublisher() | |
| } |
This file contains hidden or 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
| public extension Comparable { | |
| func clamped(to limits: ClosedRange<Self>) -> Self { | |
| return min(max(self, limits.lowerBound), limits.upperBound) | |
| } | |
| } |
OlderNewer