Swift is a powerful and intuitive programming language for Apple platforms and beyond.

Posts under Swift tag

200 Posts

Post

Replies

Boosts

Views

Activity

Programming Languages Resources
This topic area is about the programming languages themselves, not about any specific API or tool. If you have an API question, go to the top level and look for a subtopic for that API. If you have a question about Apple developer tools, start in the Developer Tools & Services topic. For Swift questions: If your question is about the SwiftUI framework, start in UI Frameworks > SwiftUI. If your question is specific to the Swift Playground app, ask over in Developer Tools & Services > Swift Playground If you’re interested in the Swift open source effort — that includes the evolution of the language, the open source tools and libraries, and Swift on non-Apple platforms — check out Swift Forums If your question is about the Swift language, that’s on topic for Programming Languages > Swift, but you might have more luck asking it in Swift Forums > Using Swift. General: Forums topic: Programming Languages Swift: Forums subtopic: Programming Languages > Swift Forums tags: Swift Developer > Swift website Swift Programming Language website The Swift Programming Language documentation Swift Forums website, and specifically Swift Forums > Using Swift Swift Package Index website Concurrency Resources, which covers Swift concurrency How to think properly about binding memory Swift Forums thread Other: Forums subtopic: Programming Languages > Generic Forums tags: Objective-C Programming with Objective-C archived documentation Objective-C Runtime documentation Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
0
0
843
Oct ’25
Error Blocking Phone Numbers
In my case, when I try to block calls on iOS 26, the blocking doesn't occur; the scenarios seem intermittent. If I create two CallDirectory extensions, the first blocks the numbers, but the second doesn't. Interestingly, the extension marks the number as suspicious. There's also a case where, on iOS 26 on an iPhone 16 Pro, the functionality doesn't work at all. I'd like to know if there have been any changes to the use of CallKit in iOS 26, because users of my app on iOS 18 and below report successful blocking.
0
0
9
3h
Weird crash: missing symbol Swift.AsyncIteratorProtocol.next()
I got several reports about our TestFlight app crashing unconditionally on 2 devices (iOS 18.1 and iOS 18.3.1) on app start with the following reason: Termination Reason: DYLD 4 Symbol missing Symbol not found: _$sScIsE4next7ElementQzSgyYa7FailureQzYKF (terminated at launch; ignore backtrace) The symbol in question demangles to (extension in Swift):Swift.AsyncIteratorProtocol.next() async throws(A.Failure) -> A.Element? Our deploy target is iOS 18.0, this symbol was introduced in Swift 6.0, we're using latest Xcode 16 now - everything should be working, but for some reason aren't. Since this symbol is quite rarely used directly, I was able to pinpoint the exact place in code related to it. Few days ago I added the following code to our app library (details omitted): public struct AsyncRecoveringStream<Base: AsyncSequence>: AsyncSequence { ... public struct AsyncIterator: AsyncIteratorProtocol { ... public mutating func next(isolation actor: isolated (any Actor)? = #isolation) async throws(Failure) -> Element? { ... } } } I tried to switch to Xcode 26 - it was still crashing on affected phone. Then I changed next(isolation:) to its older version, next(): public mutating func next() async throws(Failure) -> Element? And there crashes are gone. However, this change is a somewhat problematic, since I either have to lower Swift version of our library from 6 to 5 and we loose concurrency checks and typed throws or I'm loosing tests due to Swift compiler crash. Performance is also affected, but it's not that critical for our case. Why is this crash happening? How can I solve this problem or elegantly work around it? Thank you! 2025-10-09_17-13-31.7885_+0100-23e00e377f9d43422558d069818879042d4c5c2e.crash
3
0
180
20h
Static library produced by Xcode 26 causes link error on Xcode 16
When a static library is built with Xcode 26 (with deployment target set to iOS 13) and then linked into an app project compiled with Xcode 16, the build process fails with the following linker error: Undefined symbols for architecture arm64: "_swift_coroFrameAlloc" This occurs even though both the static library and the app project have their deployment targets set to iOS 13.0. The static library works on Xcode 26, but fails to link on Xcode 16. This issue shows up with certain Swift syntax. For example, in my case, using a property getter and setter caused the compiler to emit a reference to _swift_coroFrameAlloc, which in turn triggered the issue. This issue prevents us from distributing pre-built static libraries compiled with Xcode 26 to teammates who are still using Xcode 16. I’ve filed feedback for this issue (FB21130604). Is there any way to work around it? For example, by adding specific Build Settings or something similar? A demo project is available here: https://github.com/Naituw/SwiftLibraryDeploymentTargetIssue The demo project includes: StaticLibraryProject: A simple Swift static library with property getter setter usage AppProject: An iOS app that links against the static library verify_compatibility.sh: An automated script to reproduce the issue Method 1: Manual Build and Verification Open StaticLibraryProject/StaticLibraryProject.xcodeproj in Xcode 26 Build the StaticLibraryProject for iOS device (Release configuration) Locate the built libStaticLibraryProject.a in the build products directory Copy libStaticLibraryProject.a to AppProject/AppProject/ directory Open AppProject/AppProject.xcodeproj in Xcode 16 Build the AppProject for iOS device Method 2: Automated Script Edit verify_compatibility.sh to configure the paths to your Xcode installations: Set XCODE_26_PATH to your Xcode 26 installation path (e.g., /Applications/Xcode.app) Set XCODE_16_PATH to your Xcode 16 installation path (e.g., /Applications/Xcode16.app) Run the script: ./verify_compatibility.sh
2
0
140
23h
DeclaredAgeRange framework and types missing much needed Sendable and Hashable conformance
Like any good developer, I try to add tests where I can. The AgeRangeService.AgeRange type does not provide an initializer. I know the routine, create an interface or a simple struct that I control and use that instead. Thanks to extensive time with frameworks like Core Bluetooth or Core Location, this is a well understood practice (looking at you CBPeripheral...). Great I'll make my own 'AgeRange' struct. Make it Hashable, make it Sendable, use the framework types as properties. Scratch that, most of the properties on AgeRangeService.AgeRange type are not Sendable and many are also not Hashable. This is proving to be challenging. I hope to open source my little Swift Package wrapper library for DeclaredAgeRange which will add types with full Hashable and Sendable conformance. I hope Apple updates the API and makes this obsolete. I don't see why these simple types can't be Hashable and Sendable. They're structs, enums, and OptionSets (structs). FB20959748 - DeclaredAgeRange: DeclaredAgeRangeAction is not sendable causing main actor compile errors with default isolation settings FB20960560 - DeclaredAgeRange: AgeRangeService.AgeRangeDeclaration is not sendable as expected FB20960574 - DeclaredAgeRange: AgeRangeService.ParentalControls is not sendable as expected FB20960590 - DeclaredAgeRange: AgeRangeService.ParentalControls is not hashable as expected On the note of the library and using the types as-is, there are some issues using the new cases in AgeRangeDeclaration and the isEligibelForAgeFeatures property. I started another thread over here: https://developer.apple.com/forums/thread/808144
0
0
52
2d
How to implement NFC Reader in SwiftUI?
Hi, does anyone know how to enable creating or configuring Near NFC Reader in SwiftUI? I've already added the capability, the permissions in info.plist, the entitlement, and the SwiftUI code, but without success. Here's the example code: class PaymentT2PViewModel: NSObject, ObservableObject { @Published var paymentT2PUIState: PaymentT2PUIState // MARK: - NFC Properties @Published var nfcMessage: String = .empty @Published var isNFCReading: Bool = false private var nfcSession: NFCTagReaderSession? init(paymentT2PUIState: PaymentT2PUIState) { self.paymentT2PUIState = paymentT2PUIState super.init() ) } func startNFCReading() { print("INICIO: startNFCReading llamado") guard NFCTagReaderSession.readingAvailable else { print("ERROR: NFC NO disponible en este dispositivo") Task { @MainActor in self.nfcMessage = "NFC no disponible en este dispositivo" } return } print("NFC disponible, creando sesión...") nfcSession = NFCTagReaderSession( pollingOption: [.iso14443, .iso15693, .iso18092], delegate: self, queue: nil ) print("Sesión creada, configurando mensaje...") nfcSession?.alertMessage = "Acerca la tarjeta al iPhone" nfcSession?.begin() print("Sesión NFC INICIADA - debería aparecer popup") Task { @MainActor in self.isNFCReading = true } } func stopNFCReading() { nfcSession?.invalidate() Task { @MainActor in self.isNFCReading = false } } extension PaymentT2PViewModel: NFCTagReaderSessionDelegate { func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) { print("SESIÓN INVALIDADA") print("Error: (error.localizedDescription)") if let readerError = error as? NFCReaderError { print("Código de error: \(readerError.code.rawValue)") print("¿Es cancelación del usuario?: \(readerError.code == .readerSessionInvalidationErrorUserCanceled)") } Task { @MainActor in if let readerError = error as? NFCReaderError { if readerError.code != .readerSessionInvalidationErrorUserCanceled { self.nfcMessage = "Error: \(readerError.localizedDescription)" } } self.isNFCReading = false } } func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) { print("NFC Session activa") } func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { guard let firstTag = tags.first else { return } session.connect(to: firstTag) { [weak self] error in if let error = error { session.invalidate(errorMessage: "Error al conectar: \(error.localizedDescription)") return } Task { @MainActor [weak self] in await self?.handleTag(firstTag, session: session) } } } private func handleTag(_ tag: NFCTag, session: NFCTagReaderSession) async { switch tag { case .iso7816(let tag): await handleISO7816Tag(tag, session: session) case .miFare(let tag): await handleMiFareTag(tag, session: session) case .iso15693(let tag): await handleISO15693Tag(tag, session: session) case .feliCa(let tag): await handleFeliCaTag(tag, session: session) @unknown default: session.invalidate(errorMessage: "Tipo de tag no soportado") } } private func handleISO7816Tag(_ tag: NFCISO7816Tag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ ISO7816 Tag detectado UID: \(uid) Historical Bytes: \(tag.historicalBytes?.map { String(format: "%02X", $0) }.joined() ?? "N/A") """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleMiFareTag(_ tag: NFCMiFareTag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ MiFare Tag detectado UID: \(uid) Tipo: \(tag.mifareFamily.description) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleISO15693Tag(_ tag: NFCISO15693Tag, session: NFCTagReaderSession) async { let uid = tag.identifier.map { String(format: "%02X", $0) }.joined() nfcMessage = """ ISO15693 Tag detectado UID: \(uid) IC Manufacturer: \(tag.icManufacturerCode) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } private func handleFeliCaTag(_ tag: NFCFeliCaTag, session: NFCTagReaderSession) async { let idm = tag.currentIDm.map { String(format: "%02X", $0) }.joined() let pmm = tag.currentSystemCode.map { String(format: "%02X", $0) }.joined() nfcMessage = """ FeliCa Tag detectado IDm: \(idm) System Code: \(pmm) """ session.alertMessage = "Tag leído exitosamente" session.invalidate() } } // MARK: - Helper Extension extension NFCMiFareFamily { var description: String { switch self { case .unknown: return "Desconocido" case .ultralight: return "Ultralight" case .plus: return "Plus" case .desfire: return "DESFire" @unknown default: return "Otro" } } } struct PaymentT2PView: View { @ObservedObject var paymentT2PViewModel: PaymentT2PViewModel var body: some View { ZStack { if paymentT2PViewModel.paymentT2PUIState.showingResult { print("Navigate") } else { print("False") } } .onAppear { paymentT2PViewModel.startNFCReading() } .onDisappear { paymentT2PViewModel.stopNFCReading() } }} However, I'm getting code error messages, and I'm testing this on an iPhone 11. What am I doing wrong?
0
0
199
3d
Unwanted animations appear on UIButton (iOS 26)
After the iOS 26 update, unwanted animations appear on UIButton. I'm using the attributedTitle property of UIButton.Configuration to change the button's text, and an animation appears after iOS 26. (It's unclear whether it's after iOS 26.0 or iOS 26.1, but it likely started with 26.1.) The peculiar thing is that the animation only starts appearing on buttons that have been pressed once. I tried using UIView.performWithoutAnimation and CATransaction's begin(), setDisableActions(true), commit(), but it didn't work. How should I solve this? Below is the code for changing the button's text. func updateTitle() { let keys = type.keys if keys.count == 1 { guard let key = keys.first else { return } if key.count == 1 { if Character(key).isLowercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 24, weight: .regular), .foregroundColor: UIColor.label])) } else if Character(key).isUppercase { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } } else { self.configuration?.attributedTitle = AttributedString(key, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 18, weight: .regular), .foregroundColor: UIColor.label])) } } else { let joined = keys.joined(separator: "") self.configuration?.attributedTitle = AttributedString(joined, attributes: AttributeContainer([.font: UIFont.systemFont(ofSize: 22, weight: .regular), .foregroundColor: UIColor.label])) } }
0
0
48
3d
Live Activity (Dynamic Island) suddenly stopped working without code changes
Hi everyone, I am encountering an issue where my Live Activity (Dynamic Island) suddenly became invalid and failed to launch. It was working perfectly before, and I haven't modified any code since then. My Environment: Xcode: 26.1.1 Device iOS: 26.1 Testing: I also tested on iOS 18, but the Live Activity fails to start there as well. Here is my code: Live Activity Manager (Start/Update/End): func startLiveActivity() { // Initial static data let attributes = SimpleIslandAttributes(name: "Test Order") // Initial dynamic data let initialContentState = SimpleIslandState(message: "Preparing...") // Adapting for iOS 16.2+ new API (Content) let activityContent = ActivityContent(state: initialContentState, staleDate: nil) do { let activity = try Activity.request( attributes: attributes, content: activityContent, pushType: nil // Set to nil as remote push updates are not needed ) print("Live Activity Started ID: \(activity.id)") } catch { print("Failed to start: \(error.localizedDescription)") } } // 2. Update Live Activity func updateLiveActivity() { Task { let updatedState = SimpleIslandState(message: "Delivering 🚀") let updatedContent = ActivityContent(state: updatedState, staleDate: nil) // Iterate through all active Activities and update them for activity in Activity<SimpleIslandAttributes>.activities { await activity.update(updatedContent) print("Update") } } } // 3. End Live Activity func endLiveActivity() { Task { let finalState = SimpleIslandState(message: "Delivered ✅") let finalContent = ActivityContent(state: finalState, staleDate: nil) for activity in Activity<SimpleIslandAttributes>.activities { // dismissalPolicy: .default (immediate), .after(...) (delayed), .immediate (no animation) await activity.end(finalContent, dismissalPolicy: .default) print("End") } } } The Models (Shared between App and Widget Extension): // 1. Define State (Dynamic data, changes over time, e.g., remaining delivery time) public struct SimpleIslandState: Codable, Hashable { var message: String } // 2. Define Attributes (Static data, constant after start, e.g., Order ID) public struct SimpleIslandAttributes: ActivityAttributes { public typealias ContentState = SimpleIslandState var name: String // e.g., "My Order" } The Widget Code: // // SimpleIslandWidget.swift // ReadyGo // // Created by Tang Yu on 2025/11/19. // import WidgetKit import SwiftUI import ActivityKit struct SimpleIslandWidget: Widget { var body: some WidgetConfiguration { ActivityConfiguration(for: SimpleIslandAttributes.self) { context in // UI shown on the Lock Screen VStack { Text("Lock Screen Notification: \(context.state.message)") } .activityBackgroundTint(Color.cyan) .activitySystemActionForegroundColor(Color.black) } dynamicIsland: { context in // Inside Widget Extension DynamicIsland { // Expanded Region DynamicIslandExpandedRegion(.center) { Text("Test") // Pure text only } } compactLeading: { Text("L") // Pure text only } compactTrailing: { Text("R") // Pure text only } minimal: { Text("M") // Pure text only } } } } Additional Info: This is the minimal code setup I created for testing, but even this basic version is failing. I have set NSSupportsLiveActivities (Supports Live Activities) to YES (true) in the Info.plist for both the Main App and the Widget Extension. Has anyone experienced this? Any help would be appreciated.
3
0
71
3d
Question about testing the Declared Age Range feature
I’m integrating the Declared Age Range feature to tailor our app’s experience based on a user’s age range. I’m currently in the testing phase and would like to repeatedly test the consent flow and different outcomes from AgeRangeService.shared.requestAgeRange(...). However, once I go through the consent flow and choose to share, the age-range sharing sheet no longer appears on subsequent attempts—so it’s hard to validate edge cases (e.g., changed gates, declined flow, re-prompt behavior). Could you advise on the recommended way to reset or re-prompt during development? In particular: Is there a supported way to clear per-app consent so the system prompts again? Under what conditions should the “Share Age Range Again” control appear in Settings, and is there an equivalent way to trigger it for testing? Are there best practices for QA (e.g., using Ask First at the system level, testing on real devices vs. Simulator, using a separate bundle ID for dev builds, or other steps)? Any other guidance for validating different requestAgeRange results (e.g., declined/not available) would be appreciated.
3
1
242
4d
How to dynamically update an existing AVComposition when users add a new custom video clip?
I’m building a macOS video editor that uses AVComposition and AVVideoComposition. Initially, my renderer creates a composition with some default video/audio tracks: @Published var composition: AVComposition? @Published var videoComposition: AVVideoComposition? @Published var playerItem: AVPlayerItem? Then I call a buildComposition() function that inserts all the default video segments. Later in the editing workflow, the user may choose to add their own custom video clip. For this I have a function like: private func handlePickedVideo(_ url: URL) { guard url.startAccessingSecurityScopedResource() else { print("Failed to access security-scoped resource") return } let asset = AVURLAsset(url: url) let videoTracks = asset.tracks(withMediaType: .video) guard let firstVideoTrack = videoTracks.first else { print("No video track found") url.stopAccessingSecurityScopedResource() return } renderer.insertUserVideoTrack(from: asset, track: firstVideoTrack) url.stopAccessingSecurityScopedResource() } What I want to achieve is the same behavior professional video editors provide, after the composition has already been initialized and built, the user should be able to add a new video track and the composition should update live, meaning the preview player should immediately reflect the changes without rebuilding everything from scratch manually. How can I structure my AVComposition / AVMutableComposition and my rendering pipeline so that adding a new clip later updates the existing composition in real time (similar to Final Cut/Adobe Premiere), instead of needing to rebuild everything from zero? You can find a playable version of this entire setup at :- https://github.com/zaidbren/SimpleEditor
0
0
260
5d
iOS 26.1 adds dark tint under transparent tab bar and ui elements (worked correctly in iOS 26)
After updating from iOS 26 to iOS 26.1, all my transparent system elements (i.e. UITabBar, UIBarButtonItem) started rendering with a dark background tint. In iOS 26 the same configuration looked fully transparent / glassy. The strange part is that the tint only appears in normal UIViewControllers. In UITableViewController the tab bar still looks correct and transparent, even on iOS 26.1. I am using the same appearance code as before: func setupTabBarAppearance() { guard let tabBar = tabBarController?.tabBar else { return } if #available(iOS 26.0, *) { let appearance = UITabBarAppearance() appearance.configureWithTransparentBackground() appearance.backgroundColor = .clear appearance.backgroundEffect = nil appearance.shadowColor = .clear tabBar.standardAppearance = appearance tabBar.scrollEdgeAppearance = appearance tabBar.isTranslucent = true tabBar.backgroundColor = .clear tabBar.barTintColor = .clear } else { tabBar.isTranslucent = true tabBar.backgroundImage = UIImage() tabBar.shadowImage = UIImage() tabBar.backgroundColor = .clear } } I tried removing backgroundEffect, forcing .clear colors, using configureWithDefaultBackground, changing edgesForExtendedLayout, extendedLayoutIncludesOpaqueBars, etc. I noticed that if I change Liquid Glass in iOS 26 settings from Clear to Tinted, then I get a black tint everywhere and the interface becomes consistent, but not the way I want. Nothing removes the new dark tint in iOS 26.1. Is this an intentional change in iOS 26.1, a bug, or is there a new way to make the tab bar fully transparent again?
1
0
66
6d
Severe Scroll Lag & Header Flickering in Complex SwiftUI Screen with Dynamic Content (GeometryReader + Scroll Direction Detection)
I’m working on a SwiftUI screen where I need to hide a header when the user scrolls down and show it again when the user scrolls up. I’m currently using a ScrollView combined with GeometryReader to detect scroll offset changes and update state variables like isScrolling or isScrollingDown. The issue is that the behavior is inconsistent. When I scroll down, the header hides correctly, but when I scroll back up, the header often doesn’t appear again even though the offset is changing. Sometimes the header comes back with a delay, and other times it never appears at all. Along with this, I’m also seeing noticeable UI lag whenever I try to calculate content height or read multiple geometry values inside the ScrollView. It looks like the frequent state updates inside the scroll offset tracking are causing layout recalculations and frame drops. I’ve tried placing the header in different positions (inside a ZStack aligned to the top, inside the VStack above the ScrollView, and with transitions like .push(from: .top)), but the result is still the same: smooth scrolling breaks, and the header doesn’t reliably animate back when scrolling upward. What I’m looking for is a minimal and efficient approach to detect scroll direction and trigger the header hide/show animation without causing performance issues or recomputing expensive layout values. Any guidance or a simplified pattern that works well for dynamic headers in SwiftUI would be very helpful. if isScrolling { headerStackView() //Includes Navigation Bar .transition( .asymmetric( insertion: .push(from: .top), removal: .push(from: .bottom) ) ) } GeometryReader { outer in let outerHeight = outer.size.height ScrollView(.vertical) { VStack { content() // Heavy view + contains its own ScrollView } .background { GeometryReader { proxy in let contentHeight = proxy.size.height let minY = max( min(0, proxy.frame(in: .named("ScrollView")).minY), outerHeight - contentHeight ) if #available(iOS 17.0, *) { Color.clear .onChange(of: minY) { oldVal, newVal in // Scroll direction detection if (isScrolling && newVal < oldVal) || (!isScrolling && newVal > oldVal) { isScrolling = newVal > oldVal } } } } } } .coordinateSpace(name: "ScrollView") } .padding(.top, 1)
2
0
45
6d
Xcode Cloud cannot detect my custom build script
Subject: Xcode Cloud not detecting ci_scripts/ci_post_clone.sh for Flutter iOS build Description: I'm attempting to build a Flutter iOS app using Xcode Cloud, but the build is failing because Xcode Cloud cannot detect my custom build script located at ci_scripts/ci_post_clone.sh in the repository root. Setup: Repository: https://github.com/GlamTam2000/King-chi-app Branch: ios-build-legacy Xcode Project: flutter_application_1/ios/Runner.xcworkspace Xcode Version specified: 15.4 Issue: The Xcode Cloud build logs consistently show: Post-Clone script not found at ci_scripts/ci_post_clone.sh However, the script file is confirmed to exist in the repository: The file is committed and pushed to GitHub (commit 9bd3aa1) Local git verification: git ls-tree HEAD ci_scripts/ shows the file exists File permissions: 100755 (executable) File location: Repository root /ci_scripts/ci_post_clone.sh What I've tried: Created ci_scripts/ci_post_clone.sh at repository root with executable permissions Ensured Unix line endings (LF, not CRLF) Removed macOS extended attributes Tried both ci_post_clone.sh and ci_pre_xcodebuild.sh scripts Created empty commits to force Xcode Cloud to fetch latest changes Verified the file exists locally and in git history Why I need this script: Flutter requires running flutter build ios --release --no-codesign before Xcode can build, which generates the FlutterGeneratedPluginSwiftPackage that Xcode depends on. Without this script running, the build fails with: Could not resolve package dependencies: the package at '.../FlutterGeneratedPluginSwiftPackage' cannot be accessed Question: Why is Xcode Cloud not detecting the ci_scripts/ci_post_clone.sh file even though it exists in the repository root? Is there a specific configuration in App Store Connect or a Xcode Cloud workflow setting that needs to be enabled for custom scripts to run? Additional files in repository (also not working): .xcode-version at repository root (specifying 15.4) .xcodecloud.yml at repository root (with workflow configuration) Any guidance on how to make Xcode Cloud properly detect and execute custom build scripts would be greatly appreciated. This gives Apple Support all the key information they need to help diagnose why the scripts aren't being detected.
0
0
20
6d
Error in Xcode console
Lately I am getting this error. GenerativeModelsAvailability.Parameters: Initialized with invalid language code: en-GB. Expected to receive two-letter ISO 639 code. e.g. 'zh' or 'en'. Falling back to: en Does anyone know what this is and how it can be resolved. The error does not crash the app
3
1
1.1k
1w
iOS Dark mode Liquid Glass Tab bar with Reduce Transparency Issue
Hi, I have an iOS app that I’m trying to update with Liquid Glass. In this app, I’m using a tab bar, which works fine with Liquid Glass, but as soon as I enable the “Reduce Transparency” setting in dark mode, I get a strange effect: at launch, the tab bar appears correctly in dark mode, but after scrolling a bit in the view, it eventually switches to light mode 😅 At launch: After a bit of scrolling: I can’t figure out whether this is intended behavior from the framework or not (I don’t have this issue with other apps). I can reproduce it in a project built from scratch, here is the code (don't forget to set dark mode to the device and activate the reduce transparency option in the accessibility menu): struct ContentView: View { var body: some View { TabView { ScrollView { LazyVStack { ForEach(0..<100) { _ in Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello world").foregroundStyle(.primary) } } .padding() } .tabItem { Label("Menu", systemImage: "list.dash") } } } } Do you know if this is expected behavior? Or if there’s something that can be done about it? Thanks,
1
0
75
1w
How to check if a sandboxed app already has the access permission to a URL
I want to check whether a sandboxed application already has access permission to a specific URL. Based on my investigation, the following FileManager method seems to be able to determine it: FileManager.default.isReadableFile(atPath: fileURL.path) However, the method name and description don't explicitly mention this use case, so I'm not confident there aren't any oversights. Also, since this method takes a String path rather than a URL, I'd like to know if there's a more modern API available. I want to use this information to decide whether to prompt the user about the Sandbox restriction in my AppKit-based app.
5
0
152
1w
Launch The Main App from LockedCameraCapture
If the app is launched from LockedCameraCapture and if the settings button is tapped, I need to launch the main app. CameraViewController: func settingsButtonTapped() { #if isLockedCameraCaptureExtension //App is launched from Lock Screen //Launch main app here... #else //App is launched from Home Screen self.showSettings(animated: true) #endif } In this document: https://developer.apple.com/documentation/lockedcameracapture/creating-a-camera-experience-for-the-lock-screen Apple asks you to use: func launchApp(with session: LockedCameraCaptureSession, info: String) { Task { do { let activity = NSUserActivityTypeLockedCameraCapture activity.userInfo = [UserInfoKey: info] try await session.openApplication(for: activity) } catch { StatusManager.displayError("Unable to open app - \(error.localizedDescription)") } } } However, the documentation states that this should be placed within the extension code - LockedCameraCapture. If I do that, how can I call that all the way down from the main app's CameraViewController?
3
0
428
1w
Announcing the Swift Student Challenge 2026
Announcing the Swift Student Challenge 2026 Every year, Apple’s Swift Student Challenge celebrates the creativity and ingenuity of student developers from around the world, inviting them to use Swift and Xcode to solve real-world problems in their own communities and beyond. Learn more → https://developer.apple.com/swift-student-challenge/ Submissions for the 2026 challenge will open February 6 for three weeks, and students can prepare with new Develop in Swift tutorials and Meet with Apple code-along sessions. The Apple Developer team is here is to help you along the way - from idea to app, post your questions at any stage of your development here in this forum board or be sure to add the Swift Student Challenge tag to your technology-specific forum question. Your designs. Your apps. Your moment.
4
3
763
1w
Async function doesn’t see external changes to an inout Bool in Release build
Title Why doesn’t this async function see external changes to an inout Bool in Release builds (but works in Debug)? Body I have a small helper function that waits for a Bool flag to become true with a timeout: public func test(binding value: inout Bool, timeout maximum: Int) async throws { var count = 0 while value == false { count += 1 try await Task.sleep(nanoseconds: 0_100_000_000) if value == true { return } if count > (maximum * 10) { return } } } I call like this: var isVPNConnected = false adapter.start(tunnelConfiguration: tunnelConfiguration) { [weak self] adapterError in guard let self = self else { return } if let adapterError = adapterError { } else { isVPNConnected = true } completionHandler(adapterError) } try await waitUntilTrue(binding: &isVPNConnected, timeout: 10) What I expect: test should keep looping until flag becomes true (or the timeout is hit). When the second task sets flag = true, the first task should see that change and return. What actually happens: In Debug builds this behaves as expected: when the second task sets flag = true, the loop inside test eventually exits. In Release builds the function often never sees the change and gets stuck until the timeout (or forever, depending on the code). It looks like the while value == false condition is using some cached value and never observes the external write. So my questions are: Is the compiler allowed to assume that value (the inout Bool) does not change inside the loop, even though there are await suspension points and another task is mutating the same variable? Is this behavior officially “undefined” because I’m sharing a plain Bool across tasks without any synchronization (actors / locks / atomics), so the debug build just happens to work? What is the correct / idiomatic way in Swift concurrency to implement this kind of “wait until flag becomes true with timeout” pattern? Should I avoid inout here completely and use some other primitive (e.g. AsyncStream, CheckedContinuation, Actor, ManagedAtomic, etc.)? Is there any way to force the compiler to re-read the Bool from memory each iteration, or is that the wrong way to think about it? Environment (if it matters): Swift: [fill in your Swift version] Xcode: [fill in your Xcode version] Target: iOS / macOS [fill in as needed] Optimization: default Debug vs. Release settings I’d like to understand why Debug vs Release behaves differently here, and what the recommended design is for this kind of async waiting logic in Swift.
2
0
1k
1w