Post

Replies

Boosts

Views

Activity

Reply to SwiftUI - Determining Current Device and Orientation
As a needed a Combine-free solution, I resorted using some good code form: https://www.hackingwithswift.com/quick-start/swiftui/how-to-detect-device-rotation But this code has a potential issue with initial state, especially for iPads and navigation, so I introduced a fix: **@State private var orientation = UIDevice.current.orientation ** instead of: @State private var orientation = UIDeviceOrientation.unknown
Aug ’24
Reply to why is combine not supported on linux
As a needed a Combine-free solution, I resorted using some good code form: https://www.hackingwithswift.com/quick-start/swiftui/how-to-detect-device-rotation But this code has a potential issue with initial state, especially for iPads and navigation, so I introduced a fix: **@State private var orientation = UIDevice.current.orientation ** instead of: @State private var orientation = UIDeviceOrientation.unknown
Aug ’24
Reply to Sign in with Apple button dark mode in Swift
maybe I am wrong, but... you instantiate TWICE: authorizationButton = ASAuthorizationAppleIDButton(authorizationButtonType: .signIn, authorizationButtonStyle: .black) let type = ASAuthorizationAppleIDButton.ButtonType.init(rawValue: authButtonType) ?? .default let style = ASAuthorizationAppleIDButton.Style.init(rawValue: authButtonStyle) ?? .black authorizationButton = ASAuthorizationAppleIDButton(authorizationButtonType: type, authorizationButtonStyle: style)
Aug ’24
Reply to Error Domain=NSCocoaErrorDomain Code=4099
same for me using google maps foe iOS. maybe a google issue, Burt for sure apple does not help finding what. Google Maps SDK for iOS version: 8.4.0.0 Updating selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated: failed at lookup with error 3 - No such process.}
Aug ’24
Reply to Xcode in windows pc
I have been programming on macOS since 1992. I read a lot of similar questions just some ideas: if you want to learn to ride an horse, You need and horse... put simply APPLE does not want you use a "non-controlled" OS / hardware, they fear someone can hack their ecosystem even if feasible, a decent Mac just to start, can cost 1K $, similar to a decent PC. A 300 $ PC is simply unusable even if house Visual studio / eclipse or other ide. I can barely accept this kind of question in 90's years when a Mac price was from 5 to 10 times a PC, not now.
Aug ’24
Reply to XCode 16 beta 3 creating a folder instead of a group for all project initial content
I did try to make a group. You say ".. Create groups with associated folders by default when using the New Group and New Group from Selection commands in the Project Navigator. To create a group without a folder, hold the Option key in the context menu to reveal the New Group without Folder variant of the command." (I am using Version 16.0 beta 3 (16A5202i) but I see only: If Use use instead option while selecting, it will open in this way:
Aug ’24
Reply to XCode 16 beta 3 creating a folder instead of a group for all project initial content
I use Xcode (and its predecessors since '90) I ALWAYS liked the old behaviour: you can selectively add folders, files, and even folder in other paths and rearrange. I have been considering that "old" behaviour FAR better that bogus management approach of Visual studio, and FAR FAR better that IntelliJ / Maven logic (all crap in every sub-folder is good!!) I did appreciate you can move file dropping around the project: helpful to keep related file together. (think about views and controller in a MVC project, for example) A project IS NOT the contents of a folder, that is Finder logic! the new PACKAGE/SPM approach is rough, but acceptable, but honestly old behaviour has many good reasons to be. If Apple did change it to allow young developers coming from Java / maven or worst VS Code to use Apple ecosystem.. id a bad choice, IMHO. otherwise.. I wuold use jet brains IDEs to exploit that behaviour. :)
Aug ’24
Reply to The application does not have permission to open "Downloads"
I am here with a similar problem, but I am a step further. (@eskimo: eventually I can open a TSI with Apple..) scenario: sandobox user chooses a folder we save url in UserDefaults using: let bookmarkData = try url.bookmarkData(options: BOOKMARK_CREATION_OPTIONS, includingResourceValuesForKeys: nil, relativeTo: nil) // save in UserDefaults setUserDefault(value: bookmarkData, for: key + SUFFIX, groupId: nil) when I reopen the bookmark, I can use it to read... BUT... if I call: ... NSWorkspace.shared.open(url) I got error. So an unexpected behaviour OR is wanted? EDIT: if I one usual Open/save dialog before, (keeping app open...) NSworkspace DOES open folder... but now there question is why I cannot leverage on securityScope.
Nov ’23
Reply to UIApplication.willEnterForegroundNotification not fired when Notification Center puts app in background
my 2 cents for SwiftUI in a cross platform way (Hope help others) import SwiftUI #if os(iOS) import UIKit #elseif os(macOS) import AppKit #endif struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .onAppEnteredBackground { print("going back") } } } //MARK: extension #if os(iOS) fileprivate let GO_DOWN = UIApplication.didEnterBackgroundNotification #elseif os(macOS) fileprivate let GO_DOWN = NSApplication.didResignActiveNotification #endif extension View { func onNotification( _ notificationName: Notification.Name, perform action: @escaping () -> Void ) -> some View { onReceive(NotificationCenter.default.publisher( for: notificationName )) { _ in action() } } func onAppEnteredBackground( perform action: @escaping () -> Void ) -> some View { onNotification( GO_DOWN, perform: action ) } }
Nov ’23
Reply to How to subclass with SwiftData?
first of all, "chapeau" for the big work, honestly core data was a mess ;) said so: cannot inherit: it's a shame .. if You use class you must allow it, otherwise us struct worse is that you cannot use a class marked with @model in other target where you don't have swiftData available, for example inside an XCTest You got: Thread 1: Fatal error: failed to find a currently active container for SwiftData/ModelContainer.swift:144: Fatal error: failed to find a currently active container for
Oct ’23