Post

Replies

Boosts

Views

Activity

Reply to SwiftUI - Determining Current Device and Orientation
Hello! I found another possible solution. Let me know if it works for you: import SwiftUI import Combine struct OrientationView: View { @State private var orientation: UIDeviceOrientation? = nil @State private var orientationChangePublisher: AnyCancellable? var body: some View { Text("Hello, World!") .onAppear { orientationChangePublisher = NotificationCenter.default.publisher(for: UIDevice.orientationDidChangeNotification) .compactMap { notification in UIDevice.current.orientation } .sink { newOrientation in orientation = newOrientation print("isLandscape: \(orientation?.isLandscape ?? false))") print("isPortrait: \(orientation?.isPortrait ?? false))") print("isFlat: \(orientation?.isFlat ?? false))") } } .onDisappear { orientationChangePublisher?.cancel() } } } #Preview { OrientationView() } Best regards.
Oct ’23
Reply to Metal default library not found
Hello guys. If you are working with the latest Xcode 15 and iOS 17, delete derived data, close Xcode (reboot your updated iPhone) and run the app. You will have to wait a couple of minutes and your app will start working again. Hopping it will work for you too. Best regards. Note: You will get lots of log messages before the screen turns on again.
Sep ’23