Explore the various UI frameworks available for building app interfaces. Discuss the use cases for different frameworks, share best practices, and get help with specific framework-related questions.

All subtopics

Post

Replies

Boosts

Views

Activity

Sharelink in WatchOS and Messages App
I’m relatively new to SwiftUI, so I’ve got a pretty basic question here. In my watchOS app, I’m using ShareLink to share a string of text to the Mail and Messages apps. Mail shows up in the ShareLink sheet just fine, but Messages doesn’t appear. What’s odd is that when I run the app in Xcode’s preview or in the Simulator, Messages does show up as a sharing option… So now I’m wondering if this is just a quirk with my device or if Apple doesn’t actually support sharing text to Messages from third-party watchOS apps yet? I know some Apple Watch apps (like Contacts) do support sending text/files to Messages, so I’m curious if anyone’s had a similar experience or knows more about this. Any insights would be super helpful!
1
0
87
1w
Control gallery preview bug
Environment: Xcode16, iOS 18.1 official version Background: I created a control center widget using a custom sf symbol Phenomenon: When I first installed it, it displayed normally in the control gallery, but when I recompiled and installed it again, the icon disappeared when I looked at it again in the control gallery. I used Console to check the error log and found that its output was' No image named 'my_custom _symbol_name' found in asset catalog for/private/var/containers/Bundle/Application/F977FCFB-DA1C-4924-8613-50531CA2A364/MyDemoApp. app/PlugIns/MyDemoApp Extension. apex '. I found that this uuid was not consistent with the uuid I print during debugging, as if the control gallery had done some kind of caching; Additionally, when I added my Control to the Control Center, it was able to display normally, and the only issue was with the Control Gallery Attempted method: -Using the system SF Symbol, it works fine and can be displayed normally in the control gallery after recompilation. However, once I switch another SF Symbols, the icons in the control gallery do not update after recompilation and installation -Restarting the device, the same issue still persists Is this a system bug or did I make a mistake? Looking forward to someone helping, thank you My Code: @available(iOSApplicationExtension 18.0, *) struct MySearchControlWidget: ControlWidget { let kind = "MySearchControlWidget" let title = "My Title" var body: some ControlWidgetConfiguration { let intent = MyCommonButtonControlWidgetIntent() StaticControlConfiguration(kind: kind) { ControlWidgetButton(action: intent) { Label("\(title)", image:"my_custom_symbol_name") } } .displayName("\(title)") } }
1
0
99
1w
侧划返回卡死
xcode16,iphone16,iOS 自定义navigationItemLeftBar,设置 navigationController?.interactivePopGestureRecognizer?.delegate = self,侧划返回一半,点击屏幕,界面卡死。 18系统之前的手机,或者非iphone16的手机没有问题。
0
0
116
1w
Crash when setting up the content view loaded from a NIB
I am trying to understand why I am seeing crash reports for my code that creates a view from a NIB like the code below. The crash occurs when referencing contentView which should have been bound when the NIB was loaded. Am I missing something here other than checking the result of the loadNibNamed function call? class MyView: NSView { @IBOutlet var contentView: NSView! init() { super.init(frame: NSRect(x: 0, y: 0, width: 84.0, height: 49.0)) commonInit() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } private func commonInit() { Bundle.main.loadNibNamed("MyView", owner: self, topLevelObjects: nil) translatesAutoresizingMaskIntoConstraints = false contentView.translatesAutoresizingMaskIntoConstraints = false addSubview(contentView) contentView.frame = self.bounds }
6
0
163
1w
I want to report a Apple bug in call recording feature during facetime audio call
I am using iphone 11 with ios version 18.1 and I found one issue in call recording during FT audio call. Call gets dropped as soon as call recording start. This bug is also reproducible on iphone 14 pro max having same ios version. I tried it 5/5 times and it is 100% reproducible. Can you please help to fix this issue. This is really a serious quality concern as per apple standards.
2
0
113
1w
How to use ManagedAppDistribution Framework
Hi I have tried the code given on link https://developer.apple.com/documentation/appdistribution/fetching-and-displaying-managed-apps. This code is not compilable in Xcode 16.1. After some fixes i am able to run the code but i am getting Error registering for message: [App catalog changed]: An unspecified, unrecoverable error occurred. Kindly help me with this.
2
0
142
1w
HStack required to get columns in a Grid
I've looked at lots of Grid examples. I've seen it documented that views within a GridRow are treated as if they were in an HStack. That's not happening for me. I have to explicitly put them into an HStack or they are treated as new rows. Here's my code: @State private var gridRows : Int = 4 @State private var gridCols : Int = 2 @State private var myItems : [Int] = Array(0...8) var body: some View { Group { if myItems.count > 0 { ScrollView([.vertical]) { Grid(alignment: .leading) { ForEach(0..<gridRows, id: \.self) { rowNdx in GridRow { HStack // <<--- { ForEach(0..<gridCols, id: \.self) { colNdx in Text("\(rowNdx) \(colNdx)") } } } } } } } } } With the HStack I get (as expected). 0 0 0 1 1 0 1 1 2 0 2 1 3 0 3 1 Without the HStack I get 0 0 0 1 1 0 1 1 ... What have I done wrong?
2
0
133
1w
How to draw emojis like the Lock Screen customisation?
On iOS you can create a new Lock Screen that contains a bunch of emoji, and they'll get put on the screen in a repeating pattern, like this: When you have two or more emoji they're placed in alternating patterns, like this: How do I write something like that? I need to handle up to three emoji, and I need the canvas as large as the device's screen, and it needs to be saved as an image. Thanks! (I've already written an emojiToImage() extension on String, but it just plonks one massive emoji in the middle of an image, so I'm doing something wrong there.)
0
0
114
1w
Widget Configuration UI "Add new item"
In the Explore enhancements to App Intents WWDC video at the 11 minute mark I see this UI in the Widget configuration. My question is, how do I configure my Widget to use this UI in the intent configuration? I tried using all different sorts of types and am unable to reproduce it in my app
2
0
136
1w
Xcode 16.1: 'Cannot Preview in This File' Error on macOS After Adding Firebase SDK
Hi, after updating Xcode to Version 16.1, I started a new multiplatform project targeting macOS and iOS. Everything worked fine until I added Firebase SDK 11.4 (using Swift Package Manager). Now, I'm facing an issue where the preview is not possible with "My Mac" after adding Firebase SDK, even with a very simple view like: struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() } } #Preview { ContentView() } However, previewing with iPhone or iPad works fine. This is really frustrating. When I run the app on a simulator (Mac, iPhone, or iPad), everything works perfectly. The error shown is Cannot preview in this file: Failed to launch [AppName] with the following path: /Users/[myname]/Library/Developer/Xcode/DerivedData/[AppName-gemeoxpjlzrshfifmgmqrkcxdeiz/Build/Products/Debug/FirebaseFirestoreInternal.framework/FirebaseFirestoreInternal Run Destination: macOS 15.1. What I have tried so far: Cleaned the build folder Re-installed Firebase SDK Any insights would be greatly appreciated! Thank you!
0
1
129
1w
AttributeGraph: AG::Graph::update_main_refs(AG::AttributeID)
Hello, I recently have crashes on my application, it results in many crashes with different reasons, here are the different main reasons: AttributeGraph: AG::Graph::update_main_refs(AG::AttributeID) SwiftUICore: closure #1 in ViewLayoutEngine.explicitAlignment(_:at:) SwiftUICore: __swift_instantiateGenericMetadata My main problem is that these crashes appeared without any major changes to my app, and they never happen when I emulate the app from xcode whether on a simulator or a real device. I have other crashes with other errors I can provide them if necessary. So I have a lot of trouble identifying where the errors come from, I tried to activate zombie objects, and address sanitizer without it revealing anything. Thanks in advance for the answers.
0
0
134
1w
iOS 18.1 crash UIHostingView.layoutSubviews() / swift_unknownObjectWeakAssign / objc_storeWeak
We're seeing sporadic crashes on devices running iOS 18.1 - both beta and release builds (22B83). The stack trace is always identical, a snippet of it below. As you can tell from the trace, it's happening in places we embed SwiftUI into UIKit via UIHostingController. Anyone else seeing this? 4 libobjc.A.dylib 0xbe2c _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 30 5 libobjc.A.dylib 0xb040 weak_register_no_lock + 396 6 libobjc.A.dylib 0xac50 objc_storeWeak + 472 7 libswiftCore.dylib 0x43ac34 swift_unknownObjectWeakAssign + 24 8 SwiftUI 0xeb74c8 _UIHostingView.base.getter + 160 9 SwiftUI 0x92124 _UIHostingView.layoutSubviews() + 112 10 SwiftUI 0x47860 @objc _UIHostingView.layoutSubviews() + 36
3
0
151
1w
PHAssetCollectionChangeRequest.removeAssets Does Not Work
Hello! I am trying to remove a photo from my Photos Library using PhotosUI. I run into this error when I attempt to delete it: "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)"" No photos access scope requirements declared for changes Failed to log access with error: access= accessor:<> identifier:82068C12-FD10-4DE2-9867-B4406FBFB706 kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 accessCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service named com.apple.privacyaccountingd}
2
0
169
1w
refreshed/updated data on widgets
Hello, I have a small lightweight macOS application that includes a medium widget but the widget does not update with new data as often as I'd like. I understand that in apple's WidgetKit documentation they mention that apple controls when the widget updates due to battery life concerns, but I'd like to know if theres any way at all to control when the widget updates or when I think it makes sense to do so if I am not able to control how often it refreshes new data. https://github.com/Alexx1105/MacStat-v2.1
2
0
155
1w
macOS SwiftUI document app always shows file picker on startup
DESCRIPTION OF PROBLEM When my Document-based macOS SwiftUI app starts up, it always presents a document picker. I would like it to open any documents that were open when the app last quit, and if none were open, open an "Untitled" document. I understand that there is a setting in System Settings-> Desktop & Dock ("Close windows when quitting an application") that will cause windows to reopen when it is turned off, but I'd like to give users a chance to opt-in for reopening docs even when that is turned on, since it is difficult to find, on by default, and might not be the desired behavior for all apps. I don't see any way to get a list of currently open documents to persist them at shutdown. And even if that's considered a bad idea, I'd at least like a way to prevent the Document picker from being shown at startup and instead create an Untitled document if no documents were open. Ideally, I'd like a way to provide this functionality in SwiftUI that doesn't require macOS 15 or later STEPS TO REPRODUCE Create a SwiftUI macOS document application in Xcode using the provided template, Give it any name you want Run it, create a new ".exampletext" document, save it. Quit the app with the document open. Re-run the app, document picker is shown. Cancel the document picker and quit the app with no windows shown. Re-run the app, document picker is shown.
2
0
139
1w
SwiftData Master Details
I want to create master details relationship between patient and vitals signs so which of option codes below are better performance wise ? Option one is master - details done manually .. option 1 @Model class TestResult { @Attribute(.primaryKey) var id: UUID var patientID: UUID Option 2 @Model final class Vital { var patient: Patient?
0
0
101
1w
SwiftUI View cannot conform custom Equatable protocol in Swift 6.
In Swift 6, stricter concurrency rules can lead to challenges when making SwiftUI views conform to Equatable. Specifically, the == operator required for Equatable must be nonisolated, which means it cannot access @MainActor-isolated properties. This creates an error when trying to compare views with such properties: Error Example: struct MyView: View, Equatable { let title: String let count: Int static func ==(lhs: MyView, rhs: MyView) -> Bool { // Accessing `title` here would trigger an error due to actor isolation. return lhs.count == rhs.count } var body: some View { Text(title) } } Error Message: Main actor-isolated operator function '==' cannot be used to satisfy nonisolated protocol requirement; this is an error in the Swift 6 language mode. Any suggestions? Thanks FB: FB15753655 (SwiftUI View cannot conform custom Equatable protocol in Swift 6.)
4
0
151
1w