I'm trying to add a ControlWidget to my WidgetBundle like this:
struct MyWidgets: WidgetBundle {
var body: some Widget {
if #available(iOSApplicationExtension 18.0, *) {
LauncherControl()
}
MyLiveActivityWidget()
HomeScreenWidget()
LockScreenWidget()
}
This works exactly as expected on iOS 18. However on iOS 17 my app seems to have no widgets at all.
The workaround described here (https://www.avanderlee.com/swiftui/variable-widgetbundle-configuration/) does not work either since WidgetBundleBuilder.buildBlock does not accept ControlWidget as an argument.
What is the correct way to include a Control widget conditionally on iOS 18?
Post
Replies
Boosts
Views
Activity
I'm building an app which has both iOS and macOS versions along with extensions on both platforms. I want the main app to be able to share data the extension using the group container and I want the app on both platforms sync data over CloudKit.
CloudKit synchronization works like a dream. The data sharing between the app and extension on iOS works also exactly as intended. However on macOS every time the app is launched I get “MyApp” would like to access data from other apps. alert dialog.
I tried initializing the ModelConfiguration both with an explicit and automatic app group container identifiers. Same results.
I am building a LockedCameraCaptureExtension for my app. The example code works as expected. I am now in the process of porting my existing camera UI to the LockedCameraCaptureExtension.
Currently, my custom UI is shown for a split second when I tap the control to open the LockedCameraCaptureExtension but it quickly exits back into Lock Screen. I assume my ported UI is doing something wrong.
What is the recommended way to debug a LockedCameraCaptureExtension? I can't get my break points to break and os_log does not seem to log anything to Console.
Are these error codes documented anywhere?
Error codes 203 and 1110 seems to happen regularly. I think they mean the following:
203: some limit reached (happens very regularly when using server-side speech recognition, less often when using on-device recognition)
1110: no speech detected
I have gotten a new one now: 1107
No idea what that means.
Various iPhones have different zoom values for the telephoto camera. Is there an API to grab this value or do I have to write a switch over current device?
I am building a widget for my app. Everything works as expected when using system fonts.
When I try to use the custom font for my app in the Text instances in my widget, the system shots down my WidgetKit extension because it runs against the 30MB memory limit for Widgets.
I have about 20 Text instances on my Widget. I initialize my font as a fileprivate global: let dinFont = Font.custom("AlteDIN1451Mittelschrift", size: 18)
Then I use Text("blah blah").font(dinFont) when I setup my labels.
When I only style a few text labels the widget renders fine. But when I try to use the font on all of them the widget extension is killed because of 30MB memory limit.
This sounds like, .font(dinFont) is creating a copy of the font instance. Is this the expected behavior?
When the system calendar complication is shown in the corner, it has the title of the upcoming event as the widget label and the time of the event as the main widget view. However the time of the event is not small and clipped to a circle like WidgetKit renders the complication but larger and curved together with the label.
Is there a way to achieve the system corner complication layout with the WidgetKit complications?
My app SolarWatch has two framework targets, SolarKit for iOS and SolarKitWatch for watchOS. For the iOS app both the app and widget extension depend on SolarKit. For the watchOS app only the watch app extension used to depend of SolarKitWatch. Everything used to build fine.
Today I added a widget extension for watchOS which depends on SolarKitWatch. This resulted in builds starting to fail because watch widget extension was unable to find SolarKitWatch-Swift.h during SwiftEmitModule step, using Xcode 14 beta 6 (14A5294g)
According to the build timeline this failure is happening after the Planning target SolarKitWatch steps for both arm64 and arm64_32 architectures. But it seems like the SolarKitWatch-Swift.h has not been created at that step yet.
One workaround is to manually build the SolarKitWatch target before building the whole app but this only works for debug builds and not archive builds.
I spent half a day trying to figure this out but nothing worked except turning off parallelizeBuildables and buildImplicitDependencies.
Is there a setting which I can use to enforce a build order besides turning off all parallelization?
I'm trying to build my app SolarWatch on Xcode Cloud. The setup was amazing. Everything setup and ready to go within 5 minutes. But my builds fail consistently where Xcode Cloud errors out when running the following build step and results in the attached error log screenshot.
Tried both with release and beta environments.
Any help appreciated.
Run command: 'source /Volumes/Task/ci_build.env && source /Volumes/Task/ci_plan.env && xcodebuild archive -workspace /Volumes/workspace/repository/SolarWatch.xcworkspace -scheme SolarWatch -destination generic/platform=iOS -archivePath /Volumes/workspace/build.xcarchive -derivedDataPath /Volumes/workspace/DerivedData -resultBundleVersion 3 -resultBundlePath /Volumes/workspace/resultbundle.xcresult -resultStreamPath /tmp/resultBundleStream3a2d7024-571e-4e16-969d-5b570b91d2a8.json -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES COMPILER_INDEX_STORE_ENABLE=NO -hideShellScriptEnvironment'
Xcode Cloud seems to be stuck at Xcode 13.2 beta 2 even if the release candidate (13C90) came a week ago and got realeased yesterday.
It builds fine but the builds are rejected by App Store Connect because they were built with an obsolete version.
Any tricks to convince Xcode Cloud to use the Xcode 13.2 (13C90)?
I have a in-house framework that I share between the main app and the widget.
The framework contains some localized strings.
These strings show up in correct language in the main app but on the widget they only show up in English.
I'm guessing the localized strings from the framework are not getting bundled in the widget extension.
Anybody with the same problem?
I'm having trouble installing the pods in the Podfile for my project.
cocoapods installs without any issues on the system ruby but running pod install crashes out badly.
Did anybody succeed in getting cocoapods to run on the DTK?
I have an app where I grab a Catalyst UINSSceneViewController and put it as the contentViewController in an NSPopover instance. Then I show it with
@objc private func statusItemClicked(_ sender: NSStatusBarButton) {
DispatchQueue.main.async {
self.popover.show(relativeTo: sender.bounds, of: sender, preferredEdge: .minY)
}
}
This works fine under Big Sur but crashes on Catalina with -[_NSPopoverWindow sceneIdentifier]: unrecognized selector sent to instance
Did anybody manage to show a Catalyst view in an NSPopover in Catalina? Am I doing something wrong?
I have a Widget which can be configured with a location through and Intent.
After updating to Xcode 12 beta 3, when I long tap the widget to pick a location, the widget rotates and only shows "Unable to load"
Anybody else getting this?
My widget needs to get that from an API to generate its timeline.
In the 3rd video of the Widget Code-Along the presenter says that the in-process foreground URLSessions should work as expected.
My widget gets stuck at placeholder view and never shows the real data.
Everything works fine and the widget renders as expected when I use some dummy data to generate the timeline.
Anybody, any success with fetching data from the Internet in a widget?