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
import Foundation | |
extension Dictionary { | |
func firstValue(where predicate: (Key, Value) -> Bool) -> Value? { | |
return self.first(where: predicate)?.value | |
} | |
} |
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
import Foundation | |
extension DateFormatter { | |
static var full: DateFormatter { | |
let formatter = DateFormatter() | |
formatter.timeStyle = .full | |
formatter.dateStyle = .long | |
return formatter | |
} | |
} |
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
import SwiftUI | |
struct SheetBinding<Item: Identifiable, SheetContent: View>: ViewModifier { | |
@Binding var item: Item? | |
let onDismiss: (() -> Void)? | |
@ViewBuilder let sheetContent: (Binding<Item>) -> SheetContent | |
@ViewBuilder func body(content: Content) -> some View { |
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
import SwiftUI | |
extension PreviewDevice { | |
// MARK: iPhone | |
static let iPhone4s: PreviewDevice = "iPhone 4s" | |
static let iPhone5: PreviewDevice = "iPhone 5" | |
static let iPhone5s: PreviewDevice = "iPhone 5s" | |
static let iPhone6: PreviewDevice = "iPhone 6" | |
static let iPhone6s: PreviewDevice = "iPhone 6s" | |
static let iPhone6sPlus: PreviewDevice = "iPhone 6s Plus" |