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
Post
Replies
Boosts
Views
Activity
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
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)
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.}
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.
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:
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. :)
good catch, helped me
a note: missing a colon:
, y: pageRect.size.height)
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.
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
)
}
}
Just note in case anyone arrived here (as I..) searching to fix:
let rc = sqlite3_config(SQLITE_CONFIG_SERIALIZED)
use:
sqlite3_open_v2(databasePath, &db, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_FULLMUTEX, nil)
instead.
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
I am in a a similar situation, similar to others in past.
BUT while debugging can we honestly WAIT 15 mins for every modification?
not good.
same for me after 2 years.. now under catalyst. in iOS works fine.
[TraitCollection] Class _UIFindNavigatorViewController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
Just a little gist: (for others.. arriving here like me)
https://gist.github.com/ingconti/e0a2ceaf243ff2e27ed02144e506d996