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 | |
| class KeyboardAvoidingHostingController<Content>: UIHostingController<Content> where Content: View { | |
| override func viewDidAppear(_ animated: Bool) { | |
| super.viewDidAppear(animated) | |
| NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillChangeFrame), name: UIResponder.keyboardWillChangeFrameNotification, object: nil) | |
| } | |
| override func viewDidDisappear(_ animated: Bool) { | |
| super.viewDidDisappear(animated) |
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 DEBUG | |
| import SwiftUI | |
| private let screenshotDirectory = "/Users/inket/Desktop/" | |
| struct PreviewScreenshot: ViewModifier { | |
| struct LocatorView: UIViewRepresentable { | |
| let tag: Int | |
| func makeUIView(context: Context) -> UIView { |
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
| // Run any SwiftUI view as a Mac app. | |
| import Cocoa | |
| import SwiftUI | |
| NSApplication.shared.run { | |
| VStack { | |
| Text("Hello, World") | |
| .padding() | |
| .background(Capsule().fill(Color.blue)) |
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
| extension UIHostingController { | |
| convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
| self.init(rootView: rootView) | |
| if ignoreSafeArea { | |
| disableSafeArea() | |
| } | |
| } | |
| func disableSafeArea() { |
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
| // | |
| // AppStorageCodable.swift | |
| // | |
| // | |
| // Created by Jesse Hemingway on 9/4/24. | |
| // | |
| import Foundation | |
| import SwiftUI |
OlderNewer