Post

Replies

Boosts

Views

Activity

How to fix "contains disallowed nested bundles" and "contains disallowed file 'Frameworks'" errors
Hi,My iOS Swift app contains a in-house built framework (A), which is also using Swift. This framework includes 2 in-house built frameworks (B and C) using Objective-C."Embedded Content Contains Swift Code" is set to YES for the app and to NO for the A, B and C frameworks.When I try to submit the app to iTC, I get these errors:ERROR ITMS-90205: "Invalid Bundle. The bundle at 'yourapp.app/Frameworks/A.framework' contains disallowed nested bundles."...ERROR ITMS-90206: "Invalid Bundle. The bundle at 'yourapp.app/Frameworks/A.framework' contains disallowed file 'Frameworks'."...How can I fix those?
9
0
43k
May ’22
SwiftUI window aspect ratio
Is there a way to force a window to resize according to an aspect ratio? This is possible in AppKit via the NSWindow.contentAspectRatio property but I cannot find something similar for SwiftUI. Basically, I want the window to maintain the aspect ratio of its contents.
4
2
2.5k
Jun ’23
.refreshable on macOS?
Is .refreshable supposed to do anything on macOS? Works fine on iOS and iPadOS but it's not triggered on macOS. It's available since macOS 12 but the documentation doesn't mention anything about that. https://developer.apple.com/documentation/swiftui/view/refreshable(action:)
2
1
1.1k
Mar ’24
Swift compiler crash with Xcode 16 beta 5
This simple project just makes the Swift compiler crash in init(comparator: KeyPathComparator<RemoteComputer>): import SwiftUI struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } enum CSItemOrderType: Int, Codable, CaseIterable, CustomStringConvertible { case readableName case lastConnectionDate case numberOfConnections var description: String { switch self { case .readableName: return "STR_NAME" case .lastConnectionDate: return "STR_LAST_CONN_DATE" case .numberOfConnections: return "STR_ORDER_MOST_CONNECTED" } } } struct CSItemOrder: Codable { static let allCases = [CSItemOrder(type: .readableName), CSItemOrder(type: .lastConnectionDate, order: .reverse), CSItemOrder(type: .numberOfConnections, order: .reverse)] static let allSortOrders = [KeyPathComparator(\RemoteComputer.readableName), KeyPathComparator(\RemoteComputer.lastConnectionDate), KeyPathComparator(\RemoteComputer.numberOfConnections)] let type: CSItemOrderType var order: SortOrder var comparator: KeyPathComparator<RemoteComputer> { switch type { case .readableName: return KeyPathComparator(\RemoteComputer.readableName, order: order) case .lastConnectionDate: return KeyPathComparator(\RemoteComputer.lastConnectionDate, order: order) case .numberOfConnections: return KeyPathComparator(\RemoteComputer.numberOfConnections, order: order) } } init(type: CSItemOrderType, order: SortOrder = .forward) { self.type = type self.order = order } init(comparator: KeyPathComparator<RemoteComputer>) throws { switch comparator.keyPath { case \RemoteComputer.readableName: self.init(type: .readableName, order: comparator.order) case \RemoteComputer.lastConnectionDate: self.init(type: .lastConnectionDate, order: comparator.order) case \RemoteComputer.numberOfConnections: self.init(type: .numberOfConnections, order: comparator.order) default: print("Unsupported keyPath: \(comparator.keyPath)") throw ItemOrderError.unsupportedKeyPath } } } struct RemoteComputer: Codable, Hashable, Identifiable { let id: Int let name: String let hostname: String? let localIpAddress: String? let vncPort: Int let sshPort: Int let publicIpAddress: String? let publicPort: Int let macAddress: String let scVersion: String let manualMode: Int let uuid: String let lastMappingStatus: String? let isAwake: Bool let unregistered: Bool let osVersion: String? let lastUpdate: Date let remoteAddress: String? let lastKeyboardLocale: String? let macSystemShortcuts: [String: [Int32]]? var readableName: String { return name.removingPercentEncoding ?? name } var lastConnectionDate: Date { return Date.now } var unwrappedPublicIpAddress: String { return publicIpAddress ?? NSLocalizedString("STR_NOT_AVAILABLE", comment: "") } var numberOfConnections: Int { return 0 } } enum ItemOrderError: Error { case unsupportedKeyPath } This code works fine in previous betas or Xcode 15.
4
1
945
Aug ’24
Product.SubscriptionInfo.Status is empty despite having valid subscription.
I don't know if this is a iOS 18.1 beta bug or some StoreKit server issues but Product.SubscriptionInfo.Status is returning an empty array in production even if the user has a valid subscription that is months away from expiring or renewing. I myself ran into this issue this morning but of course everything is fine in development mode so that makes it quite challenging to debug. Anyone else has this issue?
2
1
571
Oct ’24
Preventing animation glitch when dismissing a Menu with glassEffect
Hi everyone, I’m running into a strange animation glitch when using a Menu inside a glassEffect container. Here’s a minimal example: import SwiftUI struct ContentView: View { @Namespace private var namespace var body: some View { ZStack { Image(.background) .resizable() .frame(maxWidth: .infinity, maxHeight: .infinity) .ignoresSafeArea() GlassEffectContainer { HStack { Button("b1") {} Button("b2") {} Button("b3") {} Button("b4") {} Button("b5") {} Menu { Button("t1") { } Button("t2") { } Button("t3") { } Button("t4") { } Button("t5") { } } label: { Text("Menu") } } } .padding(.horizontal) .frame(height: 50) .glassEffect() } } } What happens: The bar looks fine initially: When you open the Menu, the entire bar morphs into the menu: When dismissing, the bar briefly animates into a solid rectangle before reapplying the glass effect: Questions: Is there a way to prevent that brief rectangle animation when dismissing the menu? If not, is it possible to avoid the morphing altogether and have the menu simply overlay on top of the bar instead of replacing it? Any ideas or workarounds would be greatly appreciated!
1
1
356
Sep ’25
Set filename to use for "Save to Files" with ShareLink?
Isn't there no way to set the default filename to use when we want to save a DataRepresentation to a file? If I export to JSON, the filename is "JSON.json" is used by iOS, even if I set the name to use in SharePreview. struct ContentView: View {     let car = Car(id: UUID(), name: "911", items:                     [Item(id: UUID(),date: .now, desc: "oil change"),                      Item(id: UUID(),date: .now, desc: "Battery")])     var body: some View {         VStack {             ShareLink(item: car, preview: SharePreview(car.name))         }         .padding()     } } extension UTType {     static var car: UTType = UTType(exportedAs: "com.acme.cararchive") } struct Car: Codable {     let id: UUID     let name: String     let items: [Item] } extension Car: Transferable {     static var transferRepresentation: some TransferRepresentation {         DataRepresentation(contentType: .json) { archive in             try JSONEncoder().encode(archive)         } importing: { data in             try JSONDecoder().decode(Car.self, from: data)         }     } } struct Item: Codable {     let id: UUID     let date: Date     let desc: String }
4
0
2.6k
Nov ’24
Placeholders for text fields embedded in forms (macOS)
It seems like there's no way to set a placeholder in a text field when it is in a form on macOS. This is not an issue on iOS. import SwiftUI struct ContentView: View { @State private var textUp = "" @State private var textDown = "" var body: some View { VStack { Form { Text("In a form:") .fontWeight(.bold) TextField("placeholder", text: $textUp) } Text("Not in a form:") .fontWeight(.bold) TextField("placeholder", text: $textDown) } .padding() } } Am I missing something or is this just not supported?
1
0
1.2k
Feb ’23
TableColumn with text and image
I'm trying to display a Label in a TableColumn but the header is not rendered properly: Here's some code: struct Computer: Identifiable { let id: UUID let name: String init(_ name: String) { id = UUID() self.name = name } } struct ContentView: View { private var computers = [Computer("iMac"), Computer("MacBook"), Computer("Mac mini")] @State private var selectedComputers = Set<Computer.ID>() @State private var sortOrder = [KeyPathComparator(\Computer.name)] var body: some View { Table(computers, selection: $selectedComputers, sortOrder: $sortOrder) { // Header rendered incorrectly TableColumn("Name", value: \.name) { computer in Label(computer.name, systemImage: "desktopcomputer") } // This works: // TableColumn("Name", value: \.name) } } } If I use a Text element instead (or not define any custom view for the TableColumn), the header is rendered properly: Am I doing it wrong or this is a bug?
1
0
1.2k
Feb ’23
NSCocoaErrorDomain 4097: connection to service named com.apple.storekitagent
We had a few users reporting this issue where our app is unable to connect to StoreKit. Failed product request from the App Store server: systemError(Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.storekitagent" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}) This occurs when calling Product.products(for:). Some users mentioned they had to restart their Mac in safe mode to make the error go away, some had DNS cache issues and clearing those helped, or some found the culprit to be Adguard. What could be causing this error as it is not very clear what's causing it?
4
0
3.5k
Feb ’24
Toolbar buttons disappearing when showing a navigation split view as a sheet
When displaying a view using a navigation Split View as a sheet, the toolbar button will disappear if you leave the app and resume it. import SwiftUI struct Folder: Hashable, Identifiable { let id = UUID() let name: String } struct ContentView: View { @State private var showingSettings = false var body: some View { VStack { Button { showingSettings.toggle() } label: { Text("Settings") } } .sheet(isPresented: $showingSettings, content: { SettingsView() }) .padding() } } struct SettingsView: View { @Environment(\.dismiss) private var dismiss @State private var selectedFolder: Folder? = nil private var folders = [Folder(name: "Recents"), Folder(name: "Deleted"), Folder(name: "Custom")] var body: some View { NavigationSplitView { SidebarView(selectedFolder: $selectedFolder, folders: folders) } detail: { VStack { if let folder = selectedFolder { Text(folder.name) } else { Text("No selection") } } .toolbar { ToolbarItem(placement: .cancellationAction) { Button { dismiss() } label: { Text("Cancel") } } ToolbarItem(placement: .confirmationAction) { Button { dismiss() } label: { Text("Save") } } } } } } struct SidebarView: View { @Binding var selectedFolder: Folder? var folders: [Folder] var body: some View { List(selection: $selectedFolder) { ForEach(folders) { folder in NavigationLink(value: folder) { Text(folder.name) } } } } } Steps to reproduce the issue: Launch the attached project on an iPad or iPad simulator Tap the Settings button Select one item in the sidebar Use the app switcher to open an other app or just leave the app Bring back the app Result: Both Cancel and Save buttons are gone. Note: This will not occur if no item is selected in the sidebar. FB12991687
4
0
1.9k
Jul ’24