Overview
I have an existing Xcode project that works fine with Xcode Cloud
I have a separate branch on to which I have migrated and made changes for Xcode 14
On the same branch I have made some code changes that is supported by Swift 5.7
Example:
var price: Int? = 100
guard let price else {
return
}
Problem
Xcode code build fails with the error Variable binding in a condition requires an initializer
Question:
Is it possible to build Xcode Cloud on Swift 5.7 or Xcode 14?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
When using NSPersistentCloudKitContainer lots of error / debug messages are shown in Xcode Debug area.
Feedback FB11794798:
Overview
When I use NSPersistentCloudKitContainer I get the following error / debug messages printed on the Xcode Debug Area.
Syncing seems to happen fine.
Tested on device and simulator.
I am still using Development (not deployed to Production yet)
I even tried with a new project using the default code generated for by enabling CloudKit coredata sync and I still get the same messages.
I have filed a feedback FB11794798
Steps to Reproduce
Create a new project check Use CoreData and Host in CloudKit check boxes
Run the project
Notice the error messages shown below.
Questions
How to resolve these errors?
Or is this a bug from the Apple Frameworks? (Feedback FB11794798)
Error / debug message printed on Xcode debug area
CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](36): Validating options: <NSCloudKitMirroringDelegateOptions: 0x600000760510> containerIdentifier:<MyContainerID> databaseScope:Private ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO useDeviceToDeviceEncryption:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<PFCloudKitContainerProvider: 0x600003764210> storeMonitorProvider:<PFCloudKitStoreMonitorProvider: 0x600003764220> metricsClient:<PFCloudKitMetricsClient: 0x600003764230> metadataPurger:<PFCloudKitMetadataPurger: 0x600003764240> scheduler:<null> notificationListener:<null> containerOptions:<null> defaultOperationConfiguration:<null> progressProvider:<NSPersistentCloudKitContainer: 0x60000205d200> test_useLegacySavePolicy:YES archivingUtilities:<PFCloudKitArchivingUtilities: 0x600003764250> bypassSchedulerActivityForInitialImport:NO
storeOptions: {
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x600003b3a190>";
NSPersistentHistoryTrackingKey = 1;
NSPersistentStoreMirroringOptionsKey = {
NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x600000c642a0>";
};
NSPersistentStoreRemoteChangeNotificationOptionKey = 1;
}
CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate observeChangesForStore:inPersistentStoreCoordinator:](416): <NSCloudKitMirroringDelegate: 0x600000c642a0>: Observing store: <NSSQLCore: 0x14080aec0> (URL: file:///Users/<my home folder>/Library/Group%20Containers/group.<app name>/<filename>.sqlite)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _setUpCloudKitIntegration](562): <NSCloudKitMirroringDelegate: 0x600000c642a0>: Successfully enqueued setup request.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest](3209): <NSCloudKitMirroringDelegate: 0x600000c642a0>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(3222): <NSCloudKitMirroringDelegate: 0x600000c642a0>: Executing: <NSCloudKitMirroringDelegateSetupRequest: 0x600001643f20> D3975DD0-1198-40F2-9D6A-B9994B9710B6
CoreData: debug: CoreData+CloudKit: -[PFCloudKitMetadataModelMigrator calculateMigrationStepsWithConnection:error:](446): Skipping migration for 'ANSCKDATABASEMETADATA' because it already has a column named 'ZLASTFETCHDATE'
Overview
I have a 3 column NavigationSplitView
On iPad I would like to detect if the sidebar (red) / content (green) is a slide over
I don't want to rely on orientation as it is possible to have multiple apps side by side and that can change the view size
Questions:
On iPad, how can I detect if sidebar (red) / content (green) is a slide over?
Or is there an alternate approach?
Code:
struct ContentView: View {
@State private var splitViewVisibility = NavigationSplitViewVisibility.automatic
var body: some View {
NavigationSplitView(columnVisibility: $splitViewVisibility) {
Color.red
} content: {
Color.green
} detail: {
Color.blue
}
}
}
Screenshot
Slide over
Not Slide Over
Overview
I have a SwiftUI list with a search field
I would like to add a keyboard shortcut for search field to be in focus
Questions:
How can I add a keyboard shortcut for search field?
import SwiftUI
struct ContentView: View {
@State private var searchText = ""
var body: some View {
NavigationStack {
List(0..<100) { index in
Text("Cell \(index)")
}
.searchable(text: $searchText)
}
}
}
Hi,
I have Xcode Cloud setup for external testers to test my app which is not yet released on the App Store.
It is a multi platform app, the iOS app is successful and is available for testing.
TestFlight External Testing - macOS (Post-Actions) status:
iOS: Successful (available for external testers)
macOS: Failed -
Beta app review submission failed (Submission limit has been reached.)
Developer Server Status doesn't seem to show any outages.
It would be great if it could be fixed and also if it is related to Apple Server issues it would be great if this is also tracked so that it is more transparent and is alerted to the relevant team to be fixed
@Jason could you help with this, many thanks!
Problem:
On macOS, unable to drag multiple car items from FolderDetail List
Single items from a list are draggable but multiple items are not draggable.
Feedback FB10128110
I am really saddened that this is not fixed for over a year. Please look into this.
Platform
macOS 14 (beta 3), macOS 13
Steps to reproduce
Run the code provided below
Tap the sidebar button to show the sidebar
Select "Folder 0" from the sidebar
Drag "car a" into "Folder 1" (Go to Folder 2 to notice this happened successfully, you will be able to see "car a" in Folder 1)
Select "Folder 0" from the sidebar
Select "car a" and "car b" and try to drag them to "Folder 2"
Expected Behaviour
"car a" and "car b" must be both draggable (multiple items should be draggable).
The entire cell needs to be draggable not just the Text.
Actual Behaviour
Though “car a” and “car b” are selected, when dragged only one of the 2 items is dragged
You also can drag them only when dragging the Text unlike in iOS where you can drag the cell.
Note:
Same code works on iOS
Code:
UTType
extension UTType {
static var car = UTType(exportedAs: "com.example.DragAndDropListDemo.car")
}
Car
import Foundation
import CoreTransferable
struct Car: Identifiable {
var id: Int
var name: String
}
//extension Car: Codable {}
extension Car: Codable, Transferable {
static var transferRepresentation: some TransferRepresentation {
CodableRepresentation(contentType: .car)
}
}
Folder
struct Folder: Identifiable, Hashable {
var id: Int
var name: String
}
DataStore
class DataStore: ObservableObject {
var folders = (0..<100).map { Folder(id: $0, name: "folder \($0)")}
var cars = [0: [Car(id: 0, name:"car a"), Car(id: 1, name:"car b")],
1: [Car(id: 2, name:"car c"), Car(id: 3, name:"car d")]]
}
Views
ContentView
struct ContentView: View {
@StateObject private var dataStore = DataStore()
@State private var selectedFolder: Folder?
var body: some View {
NavigationSplitView {
FolderList(selectedFolder: $selectedFolder,
dataStore: dataStore)
} detail: {
FolderDetail(folder: selectedFolder,
dataStore: dataStore)
}
}
}
FolderList
struct FolderList: View {
@Binding var selectedFolder: Folder?
@ObservedObject var dataStore: DataStore
var body: some View {
List(dataStore.folders, selection: $selectedFolder) { folder in
NavigationLink(value: folder) {
Text(folder.name)
.dropDestination(for: Car.self) { cars, location in
print("cars = \(cars) location = \(location)")
if let existingCars = dataStore.cars[folder.id] {
dataStore.cars[folder.id] = existingCars + cars
} else {
dataStore.cars[folder.id] = cars
}
return true
}
}
}
}
}
FolderDetail
struct FolderDetail: View {
let folder: Folder?
@ObservedObject var dataStore: DataStore
@State private var selectedCarIDs = Set<Int>()
var body: some View {
if let folder {
List(dataStore.cars[folder.id] ?? [], selection: $selectedCarIDs) { car in
Text(car.name)
.draggable(car)
}
} else {
Text("no folder selected")
}
}
}
My observations:
Passing a FocusState.Binding using focusedSceneValue seems to work only when the app uses a WindowGroup.
When the app uses a Window (single window) passing the FocusState.Binding in focusedSceneValue doesn't seem to work.
When app uses Window passing FocusState.Binding using focusedValue and receiving it in @FocusedValue seems to work.
Question:
Is this expected behaviour? (should focusedSceneValue only work for WindowGroup and not for Window?)
Hi,
Overview
I have a Mac app with a settings window. When I add a button it is added to the center.
I want it on the trailing edge, I even tried adding it as confirmationAction but doesn’t work.
Screenshot
Feedback
FB21374186
Steps to reproduce
Run the project on mac
Open the app's settings by pressing ⌘ ,
Notice that the Save button is in the center instead of the trailing edge
Code
App
import SwiftUI
@main
struct SettingsToolbarButtonBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
.frame(width: 300, height: 400)
}
}
}
SettingsView
import SwiftUI
struct SettingsView: View {
var body: some View {
NavigationStack {
Form {
Text("Settings window")
}
.toolbar {
ToolbarItem(placement: .confirmationAction) {
// Save button is the center instead of trailing edge
Button("Save") {}
}
}
.navigationTitle("Settings")
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Problem
On the macOS when Settings view is closed, the @State model is not deallocated
Feedback
FB21393010
Environment
macOS: 26.2 (25C56)
Xcode: 26.2 (17C52)
Steps to reproduce
Run the project
Open app's 'Settings
Look at the console logs
When model is created SettingsModel - init gets printed
When Settings window is closed SettingsModel - deinit is not printed, meaning it is not deallocated
Code
SettingsModel
import SwiftUI
@Observable
class SettingsModel {
init() {
print("SettingsModel - init")
}
deinit {
print("SettingsModel - deinit")
}
}
SettingsView
import SwiftUI
struct SettingsView: View {
@State var model = SettingsModel()
var body: some View {
Text("Settings")
.font(.largeTitle)
.padding(200)
}
}
App
import SwiftUI
@main
struct SettingsBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Problem
For a mac app, when the Settings view that uses @Environment(\.dismiss) it causes the subview's models to be created multiple times.
Environment
macOS: 26.2 (25C56)
Feedback
FB21424864
Code
App
@main
struct DismissBugApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
Settings {
SettingsView()
}
}
}
ContentView
struct ContentView: View {
var body: some View {
Text("Content")
}
}
SettingsView
struct SettingsView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
VStack {
Text("Settings")
SectionAView()
}
}
}
SectionAView
struct SectionAView: View {
@State private var model = SectionAViewModel()
var body: some View {
Text("A")
.padding(40)
}
}
SectionAViewModel
@Observable
class SectionAViewModel {
init() {
print("SectionAViewModel - init")
}
deinit {
print("SectionAViewModel - deinit")
}
}
Steps to reproduce (refer to the attached video)
1 - Run the app on the mac
2 - Open app's Settings
3 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - init
4 - Tap on some other app, so that the app loses focus
5 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - deinit
6 - Bring the app back to focus
7 - Notice the following logs being printed in the console:
SectionAViewModel - init
SectionAViewModel - deinit
Refer to screen recording
Topic:
UI Frameworks
SubTopic:
SwiftUI
Hi,
I have created an AppIntent in which there is a parameter called price, I have set the default value as 0.
@Parameter(title: "Price", default: 0)
var price: Int
Problem
When the shortcut is run this parameter is skipped
Aim
I still want to price to be asked however it needs to be pre-filled with 0
Question
What should I do that the shortcut can still ask the price but be pre-filled with 0?
Aim
To use a keyboard shortcut on a Multiplatform app (iOS and macOS)
When keyboard shortcut is tapped, the price needs to be printed
Problem
The same code doesn't work on iPad but works on macOS
Question:
Why is not working?
How to fix this?
Environment
macOS Big Sur - 11.6 (20G165)
Version 13.0 (13A233)
Code
@main
struct TestApp: App {
@State private var price = 0
var body: some Scene {
WindowGroup {
ContentView(price: $price)
.focusedValue(\.price, $price)
}
.commands {
PriceCommands()
}
}
}
struct ContentView: View {
@Binding var price: Int
var body: some View {
IncreasePriceButton(price: $price)
}
}
struct IncreasePriceButton: View {
@Binding var price: Int
var body: some View {
Button("Increase Price") {
price += 1
print("price = \(price)")
}
}
}
struct PriceCommandButton: View {
@FocusedBinding(\.price) var price
var body: some View {
Button("Print Price") {
print("price = \(price)")
}
}
}
struct PriceCommands: Commands {
var body: some Commands {
CommandMenu("Custom") {
PriceCommandButton()
.keyboardShortcut(KeyboardShortcut("C", modifiers: [.command, .shift]))
}
}
}
struct FocusedPriceKey: FocusedValueKey {
typealias Value = Binding<Int>
}
extension FocusedValues {
var price: FocusedPriceKey.Value? {
get { self[FocusedPriceKey.self] }
set { self[FocusedPriceKey.self] = newValue }
}
}
Hi,
My lab appointment status is pending. The lab is for tomorrow.
When would I get to know if my lab appointment has been accepted.
It is my first time for a lab appointment, also I forgot to mention the feedback IDs, would there be a way to amend the request to include the feedback IDs if that would help. (Feedback assistant was down when I booked an appointment so couldn't get the feedback IDs.)
Any help would be much appreciated as I am from a different timezone and would need to plan accordingly .... really praying I get an appointment
Overview
On macOS, in a NavigationSplitView when the menu button is added to the detail view toolbar, it seems to look disabled
Environment
Xcode: 14.1 beta 3 (14B5033e)
macOS: 13.0 Beta (22A5365d)
Code:
struct ContentView: View {
@State private var selectedNumber: Int?
var body: some View {
NavigationSplitView {
List(0..<100, selection: $selectedNumber) { number in
Text("cell \(number)")
}
} detail: {
Text("Detail")
.toolbar {
ToolbarItem {
Menu {
Button("aa") {}
Button("bb") {}
} label: {
Label("Add Bookmark", systemImage: "book")
}
}
}
}
}
}
Steps to reproduce:
Run the project on macOS
Select cell 0 on the sidebar
Click on the book toolbar button and notice the menu appear
Select cell 1 on the sidebar
Expected Behaviour
After step 4, the book toolbar button should look prominent (like it is enabled)
Actual Behaviour
After step 4, the book toolbar button looks like it is disabled.
Screenshot
Overview
I have a swift package that I have added to the app target.
On the app extension (widget) target I have added the same package under Frameworks and Libraries.
I am able to archive successfully when I do it manually
When I start a build using Xcode Cloud I get the following errors:
Error:
An internal error was detected which caused this stage to error. The error has been logged, and you can re-run this build again.
Resolve package dependencies
Command exited with non-zero exit-code: 74
fatal: could not read Username for 'http://github.com': terminal prompts disabledan out-of-date resolved file was detected at /Volumes/workspace/repository/<app name>.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies. Running resolver because the following dependencies were added: '<package name>' (https://github.com/<user name>/<package name>.git)2022-11-11 01:21:37.643 xcodebuild[2273:9107] Writing error result bundle to /var/folders/hf/lmqg8qtx531_sq5gwgt5s3ch0000gn/T/ResultBundle_2022-11-11_01-21-0037.xcresult
Make sure that Package.resolved is up to date on the '<branch name>' branch, and that this branch has been pushed to your remote repository.
Save artifacts
Upload <app name> Build 16 Logs for <app name> archive
An internal error occurred while this artifact was being saved.
Questions:
Am I missing something?
How do I resolve this issue?
Is it because of a server issue?