Search results for

Swift 6

49,194 results found

Post

Replies

Boosts

Views

Activity

Reply to Seeking clarification on macOS URLs with security scope
So, going through lots of details in no particular order: The entitlement com.apple.security.files.bookmarks.app-scope is not necessary and has no effect. Looking at our code, it's not that it’s unnecessary, it's actually that User selected read/write are both accepted as well. If you wanted to create a process that created bookmarks but didn't present open/save panels (for example, as a helper process), then you could use it. But what's confusing is this other, directly-related API where a security-scoped bookmark cannot be created under any circumstances because of the URL itself, some specific way the URL was initially created, and/or manipulated? So, the way to understand this is to invert the question, to Are there URLs which you're ALWAYS allowed to access?. The answer to that is yes. You can poke around to find other examples but they include directories like /Applications/, /Library/, and even /. Two notes on that: The right to access a given directory does NOT mean you have access to all of its subdi
Topic: App & System Services SubTopic: Core OS Tags:
1w
Reply to `onTapGesture` not triggered on `Map` views
I'm also seeing this problem with Swift Charts. This is with the latest Xcode 26 Beta 6 and iOS 26 Beta 8. This issue doesn't affect devices running iOS 18 and 17 from my testing. As such I've made this modifier which may help someone, hopefully I can remove it in the release seed but who knows! extension View { func CustomTapGesture(tapCount:Int = 1, perform action: @escaping () -> Void ) -> some View { modifier(TapGestureModifier(tapCount: tapCount, action: action)) } } struct TapGestureModifier: ViewModifier { var tapCount:Int = 1 var action: (() -> Void) func body(content: Content) -> some View { if #available(iOS 26.0, *) { content.simultaneousGesture(TapGesture(count: tapCount).onEnded { action() }) } else { content.onTapGesture(count: tapCount) { action() } } } } Which can be used like this: Text(Hello World) .CustomTapGesture(tapCount:2) { UIImpactFeedbackGenerator().impactOccurred() } To be clear, this doesn't work as well for iOS 26 users as the standard .onTapGesture b
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1w
False positive 'Deceptive Website' warning for personal domain
Hi everyone, i'm running into a problem with my personal domain being flagged as 'deceptive website' in safari, and i can't figure out how to fix it Domain: neon0404.space This is just my personal domain - i use it for adguard home, vaultwarden, some test stuff, sometimes small web tools for friends or family Nothing illegal or malicious has ever been hosted there On july 6, i launched a very simple web utility for a friend when he opened it on ios safari, he got the red 'deceptive website warning' I checked this on other different devices - all got the same warning The next day (july 7) i submitted a review request via websitereview.apple.com, but got no reply I did some digging and found that safari safe browsing daemon pulls data from google safe browsing, tencent safe browsing, and some apple's internal lists So, going one-by-one https://transparencyreport.google.com/safe-browsing/search showed up that domain is flagged for something shady Signed up in google search console and saw my domain was
Topic: Safari & Web SubTopic: General Tags:
1
0
709
1w
Reply to Should SwiftUI view models in Swift 6 be both @Observable and @MainActor?
[quote='855795022, EoinN, /thread/798211?answerId=855795022#855795022, /profile/EoinN'] My question is whether this behaviour was default or not for new Apps [/quote] As of Xcode 26.0b6 (17A5305f), creating a new project from the macOS > App template sets: Approachable Concurrency Default Actor Isolation to MainActor. However, there’s a wrinkle here. The language mode (Swift Language Version) still defaults to Swift 5. I expect that’ll change at some point, but AFAIK there’s been no official announcement about that. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: UI Frameworks SubTopic: SwiftUI Tags:
1w
Should SwiftUI view models in Swift 6 be both @Observable and @MainActor?
Hi, In the WWDC25 session Elevate an app with Swift concurrency (timestamps: 8:04 and later), the StickerViewModel is shown annotated with @Observable but not @MainActor. The narration mentions that updates happen on the main thread, but that guarantee is left implicit in the calling code. In Swift 6, though, one of the major benefits is stronger compiler enforcement against data races and isolation rules. If a view model were also annotated with @MainActor, then the compiler could enforce that observable state is only updated on the main actor, preventing accidental background mutations or updates that can cause data races between nonisolated and main actor-isolated uses. Since @Observable already signals that state changes are intended to be observed (and in practice, usually by views), it seems natural that such types should also be main-actor isolated. Otherwise, we’re left with an implicit expectation that updates will always come from the main thread, but without the compiler’s help in
6
0
214
1w
Reply to PKPassLibrary.requestAutomaticPassPresentationSuppression Behavior
Hi @RamiroDiaz-Latch, You wrote: In most cases, our code snippet works as expected, and the result is .success. However, we are also encountering other results, such as .denied, .alreadyPresenting, and .cancelled or .notSupported, which cause the Wallet to appear for users. [...] As @EtienneVTS mentioned, the API is intended to be used while an approved app is in the foreground. However, this requirement is indeed documented below: Use this method only in apps that must stay in the foreground when operating near NFC or other RF readers. This method prevents the device from automatically displaying the Apple Pay passes when it detects a compatible reader. This suppression occurs only while the app is in the foreground. The system automatically reenables the Apple Pay interface when the app goes to the background. If the app resumes, the system automatically suppresses the Apple Pay interface again. requestAutomaticPassPresentationSuppression(responseHandler:‍) https://developer.apple.com/documentation/passkit/
Topic: App & System Services SubTopic: Wallet Tags:
1w
NWConnection is crashed on iOS 15 and 16, but it works well on 17
Hello 👋 I need to implement a logic for searching for devices with our own service type using Bonjour. Using the NWBrowser, I can receive a list of all devices and connect to them. I need to utilize a WebSocket connection. By the property endpoint of NWBrowser.Result objects I can create NWConnection. Below is my implementation which works fine on iOS 17: let params = NWParameters.tcp let webSocketOptions = NWProtocolWebSocket.Options() params.defaultProtocolStack.applicationProtocols.insert(webSocketOptions, at: 0) // The `endpoint` is from `browseResultsChangedHandler` of NWBrowser let connection = NWConnection(to: endpoint, using: params) However, it doesn't work on iOS 15 and 16 because of the crash: 2024-06-01 16:07:18.136068+0300 MyApp[591:16845549] [] nw_endpoint_get_url called with null endpoint 2024-06-01 16:07:18.136932+0300 MyApp[591:16845549] [] nw_endpoint_get_url called with null endpoint, dumping backtrace: [arm64] libnetcore-3100.102.1 0 Network 0x000000018530e174 __nw_create_backtrace_string
3
0
955
Oct ’24
Confused by new Swift XPC API's xpc_listener_t and xpc_session_t types
Hey! I'm trying to create an XPC messaging feature between my daemon and main application. I'm trying to use the new Swift low-level API available from macOS 14.0. The documentation is extremely confusing when looking at it from Swift: The xpc_listener_t type Seems to be something I shouldn't use in the Swift API, and would rather have to use XPCListener. Also, it appears to have no public API other than the xpc_listener_set_peer_code_signing_requirement function. Which would make it impossible to create this type. However, when going into xpc.h, one can see that there is an API in fact: API_AVAILABLE(macos(14.0), macCatalyst(17.0)) API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_listener_t _Nullable xpc_listener_create(const char * service, dispatch_queue_t _Nullable target_queue, xpc_listener_create_flags_t flags, xpc_listener_incoming_session_handler_t incoming_session_handler, xpc_rich_error_t _Nullable * _Nullable error
3
0
74
1w
Reply to Confused by new Swift XPC API's xpc_listener_t and xpc_session_t types
[quote='855504022, erdeszbalazs, /thread/798187?answerId=855504022#855504022, /profile/erdeszbalazs'] but seem to have basically zero use in Swift as per above. [/quote] These are part of XPC’s low-level C API (using the terms from XPC Resources). You can call this from Swift, just like you can call malloc from Swift, but the NSXPCConnection and low-level Swift APIs are both nicer. [quote='855504022, erdeszbalazs, /thread/798187?answerId=855504022#855504022, /profile/erdeszbalazs'] Are they supposed to be an easier-to-use session based API? [/quote] The new session-based APIs were designed to provide a better model for XPC, one that’s more closely aligned with the reality of the underlying implementation. They were introduced around the same time as the low-level Swift API, and so that API only supports this model. The low-level C API has to support this model and the previous model for compatibility. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Supp
Topic: App & System Services SubTopic: General Tags:
1w
Applications stuck in UDP sendto syscall
Hi, We’re seeing our build system (Gradle) get stuck in sendto system calls while trying to communicate with other processes via the local interface over UDP. To the end user it appears that the build is stuck or they will receive an error “Timeout waiting to lock XXX. It is currently in use by another Gradle instance”. But when the process is sampled/profiled, we can see one of the threads is stuck in a sendto system call. The only way to resolve the issue is to kill -s KILL the stuck Gradle process. A part of the JVM level stack trace: jar transforms Thread 12 #90 prio=5 os_prio=31 cpu=0.85ms elapsed=1257.67s tid=0x000000012e6cd400 nid=0x10f03 runnable [0x0000000332f0d000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.DatagramChannelImpl.send0(java.base@17.0.10/Native Method) at sun.nio.ch.DatagramChannelImpl.sendFromNativeBuffer(java.base@17.0.10/DatagramChannelImpl.java:901) at sun.nio.ch.DatagramChannelImpl.send(java.base@17.0.10/DatagramChannelImpl.java:863) at sun.nio.ch.DatagramChannelImpl.send(java
1
0
192
1w
Apple Watch Series 6 – Display Extremely Dim and Flickering After watchOS 26.0 Beta Update (23R5350a)
I have an Apple Watch Series 6 (Model: M00H3LL/A) that was working perfectly before I updated it to watchOS 26.0 beta on 21st August 2024. The update process completed smoothly while the watch was on the charger, but immediately after the update the display became extremely dim. It’s not completely black, but so faint that it’s very difficult to see. I’ve already tried setting the brightness to maximum and also enabled maximum brightness under Accessibility settings, but the issue remains. I also tried force restarting the watch (holding the Digital Crown and side button together), but that did not resolve the issue. I know this is not a hardware issue, since the problem appeared immediately after the update, and at times the display briefly returns to normal brightness for just a few milliseconds (like a flicker). My current watchOS version is 26.0 (23R5350a).Could you please advise on how I can fix this, or confirm if this is a known issue with the beta version? Thank you.
Topic: UI Frameworks SubTopic: General
2
0
33
2w
swift package with arm64e
I use spm manage swift package, now i want my macos app support arm64e,so i add arm64e in Build Srtting -> Architectures. but i got error Could not find module 'SwiftyJSON' for target 'arm64e-apple-macos'; found: arm64-apple-macos, x86_64-apple-macos Apparently, if no limit in Package.swift, SPM will only compile versions for x86 and ARM64 architectures by default. now, how should I configure SPM to compile the arm64e version? thanks
4
0
203
2w