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
let styles: [UIFont.TextStyle] = [ | |
// iOS 17 | |
.extraLargeTitle, .extraLargeTitle2, | |
// iOS 11 | |
.largeTitle, | |
// iOS 9 | |
.title1, .title2, .title3, .callout, | |
// iOS 7 | |
.headline, .subheadline, .body, .footnote, .caption1, .caption2, | |
] |
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
enum DateFormatSelector: String { | |
/// AM or PM only | |
case a = "a" | |
case MMMM = "MMMM" | |
case yyyy = "yyyy" | |
case Hmm = "H:mm" | |
/// The 24-hour hour padding with a zero if there is only 1 digit. | |
case HHmm = "HH:mm" | |
/// The 12-hour hour padding with a zero if there is only 1 digit | |
case hhmm = "hh:mm" |
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 | |
import RealmSwift | |
class RealmManager { | |
/// Creates a `Realm` file in Documents directory | |
fileprivate var realm: Realm { | |
do { | |
return try Realm() | |
} catch let error { | |
let nsError = error as NSError |
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
extension UIApplication { | |
var windowScene: UIWindowScene? { | |
guard let scene = connectedScenes.first(where: { | |
$0.activationState == .foregroundActive | |
}) else { | |
return nil | |
} | |
return scene as? UIWindowScene | |
} | |
} |
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 | |
/// A view container that overlays its subviews with a given width proportion, aligning them in both axes. | |
/// | |
/// The `ProportionalZStack` uses a width to specify how much of width proportion its subviews must take. | |
/// | |
/// The following example creates a `ProportionalZStack` with a proposed width of 70%, | |
/// an aspectRatio of 4:3 and an offset of 80% for its subviews. | |
/// | |
/// ``` |
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
extension UIApplication { | |
var window: UIWindow? { | |
guard | |
let scene = connectedScenes.first, | |
let sceneDelegate = scene.delegate as? UIWindowSceneDelegate, | |
let uiWindow = sceneDelegate.window | |
else { | |
return nil | |
} | |
return uiWindow |
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 | |
import SwiftUI | |
struct SignatureLine { | |
var points = [CGPoint]() | |
let width = 3.0 | |
} | |
struct DrawingView: View { | |
@State private var lines = [SignatureLine]() |
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 SwiftUIToBase64View: View { | |
@Environment(\.displayScale) var displayScale | |
var body: some View { | |
Text("Hello, World!") | |
} | |
@MainActor private func ecode() -> String? { |
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
var window: UIWindow? { | |
guard | |
let scene = UIApplication.shared.connectedScenes.first, | |
let sceneDelegate = scene.delegate as? UIWindowSceneDelegate, | |
let uiWindow = sceneDelegate.window | |
else { | |
return nil | |
} | |
return uiWindow | |
} |
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 | |
@main | |
struct ScreenCaptureBlockerApp: App { | |
@State private var hidingScreen = false | |
private var window: UIWindow? { | |
guard | |
let scene = UIApplication.shared.connectedScenes.first, | |
let sceneDelegate = scene.delegate as? UIWindowSceneDelegate, |
NewerOlder