Posts

Post not yet marked as solved
2 Replies
380 Views
I am not sure if is it watchOS 10 regression, but running my widget on Apple Watch I can see Label which is supposed to be rendered redacted when Apple Watch is not on my wrist. I use the .privacySensitive() modifier by it seems not to do anything. I can use the isLuminanceReduced environment in combination with .redacted(reason: .placeholder) which works when the wrist is not raised. But there's no environment AFAIK to know when the watch is locked. BTW .redacted(reason: .privacy) don't do anything either, I have to use .placeholder. Is anyone else having issues with privacy on Apple Watch when using the .accessoryRectangular widget family? Talking about regular widget, not the Smart Stack.
Posted
by borisy.
Last updated
.
Post marked as solved
4 Replies
794 Views
I don't see upload option for the App Store connect, can only export .ipa. Also having issues with Transporter, pasting error message here. Could not create a temporary .itmsp package for the app "Redacted.ipa". Unable to determine app platform for 'Undefined' software type. Is anyone else facing the same issue? I am using Xcode 15.
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
248 Views
My goal is to have pre-made shortcuts with singular app intents, so my customers won't need to create their own shortcuts. I am using the new AppIntents API, which became available last year. I have 3 app intents, which are working as expected. I am using AppShortcutsProvider to advertise my intense as Siri Shortcuts I have updated my AppShortcutsProvider implementation struct LibraryAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { let drink1 = AppShortcut(intent: LogFirstDrink(), phrases: ["\(.applicationName) log first favourite"], shortTitle: "Log 1st favourite", systemImageName: "1.circle") let customDrink = AppShortcut(intent: LogLabelledDrink(), phrases: ["\(.applicationName) log any favourite"], shortTitle: "Log any favourite", systemImageName: "cup.and.saucer") let drink1CustomDate = AppShortcut(intent: LogFirstDrinkAtCustomDate(), phrases: ["\(.applicationName) log first favourite with date"], shortTitle: "Log 1st favourite", systemImageName: "1.square") return [drink1, drink1CustomDate, customDrink] } } ❌ I don't see my app shortcut in the "All Shortcuts" tab (AKA "Shortcuts), the first tab ❌ Sadly, I don't see my app in the beautiful iOS 17 "Suggestions From Your Apps" rectangular views either. Here's an example from Drafts. ❌ I don't see my intents/shortcuts at Spotlight. ✅ I can create custom shortcuts and browse my intents through the "Add Action" flow.
Posted
by borisy.
Last updated
.
Post marked as solved
1 Replies
879 Views
I am using UIViewController, and I need to know when devices appearance changes. Previously this worked with a delegate function. override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { super.traitCollectionDidChange(previousTraitCollection) // ⚠️ // Update UI } Xcode 15 gives us the deprecation warning. 'traitCollectionDidChange' was deprecated in iOS 17.0: Use the trait change registration APIs declared in the UITraitChangeObservable protocol The new function with the completion block registerForTraitChanges, needs the [UITrait] parameter. Both of my attempts are failing to compile. let traits = [UIUserInterfaceStyle.light, UIUserInterfaceStyle.dark] view.registerForTraitChanges(traits) { _, _ in // Update UI } Cannot convert value of type '[UIUserInterfaceStyle]' to expected argument type '[UITrait]' (aka 'Array') view.registerForTraitChanges(self.traitCollection.userInterfaceStyle) { _, _ in // Update UI } Cannot convert the value of type 'UIUserInterfaceStyle' to expected argument type '[UITrait]' (aka 'Array') Please share working code example. Also, does the completion block guarantee to run on the main thread?
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
351 Views
I use the widget as a complication. Inside the widget, I have a Label and Image. I use SF symbols for the image. It should be possible to set the image colour in the code. I tried .tint() and .foregroundStyle(). I think my colour should be visible when selecting Multicolor tint varian. How to set an accent colour for an SF symbol inside a widget? Is anyone else having issues with this? My image just renders white on a black background. watchOS 10 Xcode 15 RC
Posted
by borisy.
Last updated
.
Post marked as solved
3 Replies
562 Views
What does it mean? Please adopt cont... The error The widget background view is missing. Please ensure that you have called the `containerBackground(for: .widget) {…}` modifier in your widget view. I do use .containerBackground(Color.blue.gradient, for: .widget), but it's no longer working in Xocde beta 8
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
274 Views
AFAIK new iOS 17 widgets APIs are not supported on watchOS, which is a shame because it limits what kind of apps we can do for Apple Watch. I can see this can be disabled for the Smart Stack but for the single .accessoryRectangular performance shouldn't be an issue. Upvote this thread if you would like interactive widgets on watchOS.
Posted
by borisy.
Last updated
.
Post marked as solved
1 Replies
391 Views
I am having issues presenting one sheet on top of another. Looking into the Mail app presents a long navigation stack. List of email accounts (1) > list of messages (2) > single message view (3) > text field and suggestions list (4) 1 and 2 use new main & detail navigation with nice circular back button. You can select any message (2), and then you can hit Reply in the bottom right corner. I assume this shows a sheet (3). From the sheet select any option, like Reply. That shows another sheet with a text field and suggestions depicted below. (4) It looks like the whole navigation stack is preserved because dismissing the top sheet, shows the previous one. When I try to do the same in my app I see this nice warning message. Currently, only presenting a single sheet is supported. The next sheet will be presented when the currently presented sheet gets dismissed. UIKit speaking, in watchOS you can only present views, except, main & detail navigation introduced in watchOS 10, you can't push views. It seems like the Mail app somehow does it. I am wondering if is it a private API. I will explore 2 NavigationSplitView presented on top of each other and will report back.
Posted
by borisy.
Last updated
.
Post marked as solved
2 Replies
661 Views
I am working on a new standalone Apple Watch app. However, I am unable to see my widget in the Smart Stack. My goal is to have a singular complication for the .accessoryRectangular family. The latest beta I tried is Xcode Beta 8. I can't see the widget either on the Simulator or real hardware. I have done these steps. Added Watch App target with DT set to 10.0. Bundle ID .watchkitapp Added widget extension target with DT set to watchOS 10. Bundle ID .watchkitapp.widget Added AppIntentTimelineProvider for the widgetExtension target, all based on the example code Backyard Birds: Building an app with SwiftData and widgets Added the Widget to the same target @main struct widget: Widget { let kind: String = "widget" var body: some WidgetConfiguration { AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in widgetEntryView(entry: entry) } } } struct widgetEntryView : View { @Environment(\.widgetFamily) private var family var entry: Provider.Entry var body: some View { switch family { case .accessoryRectangular: RectangularView(entry: entry) default: Text("Not Supported") } } } What am I missing? In the past I would add the complications controller for the WatchKit, but I was hoping we don't need to do it. I will research more into complications and WidgetKit for watchOS 10 and will keep this updated for people who struggling like me.
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
615 Views
I am writing a Mac app in SwiftUI and would like to display a live-updated list of documents and folders with the ability to edit the files. First, users selects any folder with Open File Dialog and then I save the URL into UserDefaults and attempt to read list of files and folders when the app launches. Assuming I have a valid URL then I do the following: // Open the folder referenced by URL for monitoring only. monitoredFolderFileDescriptor = open(url.path, O_EVTONLY) // Define a dispatch source monitoring the folder for additions, deletions, and renamings. folderMonitorSource = DispatchSource.makeFileSystemObjectSource(fileDescriptor: monitoredFolderFileDescriptor, eventMask: .write, queue: folderMonitorQueue) App is crashes when I call DispatchSource.makeFileSystemObjectSource with the EXC_BREAKPOINT exception. FileManager.default.isReadableFile(atPath: url.path) returns false which tells me I don't have permissions to access this folder. The URL path is /Users/username/Documents/Folder I have added NSDocumentsFolderUsageDescription into the info plist. It's not clear how can I ask for permission programmatically. Theoretically my URL can point to any folder on File systems that the user selects in the Open Dialog. It's unclear what is the best practice to request permission only when necessary. Should I parse the URL for the "Documents" or "Downloads" string? I also have watched this WWDC video. Thanks for reading.
Posted
by borisy.
Last updated
.
Post not yet marked as solved
2 Replies
2.0k Views
I want to have a list in my watchOS app which allows user to select one row at a time. The row should maintain its selected state. The List works well, but I am currently using my own tap gesture recogniser: .onTapGesture() to select a row from my list, I also have to manage selection flow myself. I think it should be possible to simplify my code. I have found following List API in the Apple documentation, exactly what I need: init(selection: Binding<SelectionValue?>?, content: () -> Content). Creates a list with the given content that supports selecting a single row. I face the compilation error trying to use this init: 'init(:selection:rowContent:)' is unavailable in watchOS. The method is marked as watchOS 6.0+_ in the documentation. My deployment target is set to watchOS 6.2. Here's full code: @State var selectedItem: CustomIdentifiableHashableStruct? var body: some View { &#9;List(dataController.dataSource, selection: $selectedItem) { item in &#9;&#9;CustomHashableView(item: item) &#9;} } Thanks for reading.
Posted
by borisy.
Last updated
.
Post not yet marked as solved
1 Replies
1.7k Views
We use our own internal binary frameworks within our company. We have access to the Xcode projects and we build binaries with our CI system. Previously we needed to recompile all our frameworks for each new Xcode release, minor and major. When we updated to Swift 5.1 with module stability our frameworks could work with future versions of Xcode without recompilation. However we found a limitation in module stability which we were unable to solve. If we import one of the frameworks with @testable, and this frameworks was built with different version of Xcode, our main project fails to compile a test target. This issue preventing us upgrading to Xcode 12 easily. Module "FrameworkName" was not compiled for testing Xcode 12 suggests to Remove '@testable' to fix this issue, however because it's just a test target we would like to avoid modifying main source target just for purpose of unit testing. While our long term goal is to use SPM, we not fully adopted it yet. I was wondering is there any solution for this problem. We compile our frameworks with following 2 settings for all targets (main and test): BUILD_LIBRARY_FOR_DISTRBUTION set to YES SKIP_INSTALL set to NO Thanks for reading.
Posted
by borisy.
Last updated
.
Post not yet marked as solved
4 Replies
5.3k Views
As you might know, UIKit can't display alerts on top of each other. I'm having trouble writing SwiftUI application in WatchKit with a button, alert and action sheet.### Sequence of events1. Human taps the button2. Action sheet appears with action confirmation3. Human taps OK in the action sheet4. Action block called which can return either success or error5. In case of error, app needs to present an alert with its description#### ExpectedAlert with error description presented on top of a button#### Current&gt; Warning: Attempt to present &lt;PUICAlertSheetController: 0x823cbe00&gt; on &lt;_TtGC7SwiftUI19UIHostingControllerVS_7AnyView_: 0x80364150&gt; whose view is not in the window hierarchy!struct Favorits: View { @State private var isConfirmSheetPresent = false @State private var isAlertPresent = false @State private var error: String? var body: some View { List { Section(header: Text("Header")) { ForEach(self.dataSource) { drink in DrinkCell(drink: drink) .onTapGesture { self.selectedDrink = drink self.isConfirmSheetPresent = true } } } } .alert(isPresented: $isAlertPresent) { Alert(title: Text(error!), message: nil, dismissButton: nil) } .actionSheet(isPresented: $isConfirmSheetPresent) { ActionSheet(title: Text(""), message: nil, buttons: [.default(Text(""), action: { // Run action block })]) } } }Action blockModel.sharedInstance.run() { (success, error) in if success { // Update UI } else { // There's no way to know when confirmation alert is present // This won't work without a delay self.error = error!.localizedDescription self.isAlertPresent = true } }### SolutionsI can delay alert and it fixes the issue, but I don't believe this is the right approach. Ideally I need to know exactly when action sheet is dismissed.I also have tried this, but isConfirmSheetPresent set to false while dismiss animation is still running.while !isConfirmSheetPresent { // Display alert }
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
I have this consistent crash, I am not able to figure this out on my own. Perhaps you can have a look. The crash is happening on the main thread, after app enters background. It looks like it's related to Springboard, taking visual snapshot of the app and device rotation. This happened with iOS 13.5.1 and iPhone X. I don't see connection between device type as I also see this with iPad Mini 4. Full crash log - https://developer.apple.com/forums/content/attachment/6193bc36-ecb9-482c-96d4-7343aaca83e1 Exception Type:&#9;SIGSEGV Exception Codes: SEGV_ACCERR at&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x10 Crashed Thread:&#9;0 Application Specific Information: Memory Usage:&#9;&#9;188 / 1988 MB (9%) Thread 0 Crashed: 0&#9; CoreSVG&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x00000001a90dd538 CGSVGDocumentGetCanvasSize + 8 1&#9; CoreUI&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x00000001a2d85cb0 -[_CUIThemeSVGRendition canvasSize] + 92 2&#9; CoreUI&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x00000001a2d45d20 -[CUINamedVectorGlyph image] + 504 3&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x0000000199a72610 -[CUINamedVectorGlyph(UIKitAdditions) UIImageWithAsset:configuration:flippedHorizontally:] + 132 4&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a1929f4 __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke_2 + 352 5&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a194fd0 __82-[_UIAssetManager _lookUpObjectForTraitCollection:withAccessorWithAppearanceName:]_block_invoke + 84 6&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x0000000199aa8ec0 -[UITraitCollection _enumerateThemeAppearanceNamesForLookup:] + 240 7&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a194f10 -[_UIAssetManager _lookUpObjectForTraitCollection:withAccessorWithAppearanceName:] + 168 8&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a19286c __78-[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:]_block_invoke + 704 9&#9; UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a192360 -[_UIAssetManager imageNamed:configuration:cachingOptions:attachCatalogImage:] + 292 10&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x0000000199a759d8 -[UIImageAsset imageWithConfiguration:] + 448 11&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x0000000199a675d0 -[UIImage imageWithConfiguration:] + 876 12&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a28bc90 -[UIImageView _resolvedImageFromImage:forTrait:] + 376 13&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a28bfcc -[UIImageView _resolveImageForTrait:previouslyDisplayedImage:] + 436 14&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a28b880 -[UIImageView traitCollectionDidChange:] + 76 15&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2acc8c -[UIView _traitCollectionDidChangeInternal:] + 904 16&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2ad53c 0x1993f3000 + 15443260 17&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2ad710 0x1993f3000 + 15443728 18&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2ad710 0x1993f3000 + 15443728 19&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2ad6b4 -[UIView _wrappedProcessTraitCollectionDidChange:forceNotification:] + 508 20&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2047f8 -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 116 21&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2ad818 -[UIView _processDidChangeRecursivelyFromOldTraits:toCurrentTraits:forceNotification:] + 120 22&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;0x000000019a2d5760 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1892 // Look attached file for a full log
Posted
by borisy.
Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
I often check device type to have separate UI code between iOS and iPadOS. This is for the code which is not SwiftUI yet. I can check device type during runtime using UIDevice. However it's not as good as Swift pre-processor macros because pre-processor macros can assist compiler and should be more efficient without risks of C macros, decision is made before run-time which is preferable. If you think about UI, the main condition is screen size. iPad apps are closer to Mac than iPhone. it would be great to quickly check is code running on iPhone or iPad/Mac quickly. I have tried to use this: #if os(iOS) &#9;&#9;// Code #endif This would work for iOS VS macOS, but it doesn't understands iPadOS: Unknown operating system for build configuration 'os' Even if would does, I don't think it's possible to write something like: #if os(iPasOS || macOS) &#9;&#9;// Code #endif Thanks for reading.
Posted
by borisy.
Last updated
.