Post

Replies

Boosts

Views

Activity

SwiftUI views do not respond in UIKit UIViewController
I have a Storyboard lifecycle application which has a UIViewController as window root view controller. When I am trying to add the UIHostingController(SwiftUI view wrapped inside) to this root view controller as child view controller, the buttons and text fields in swiftUI view do not respond. But when I am adding this UIHostingController as window root view controller or Navigation view controller's top view controller, then the swiftUI views respond in this case. Please help me if I am missing anything Below is the code that is used for adding the UIHostingController as child view controller which doesn't work [self addChildViewController:hostingController]; [self.view addSubview:hostingController.view]; [hostingController didMoveToParentViewController:self]; This is the code that works (in delegate) [window setRootViewController:hostingController]; OR this code UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:hostingController]; [window setRootViewController:navController];
2
0
4.5k
Dec ’20
WidgetKit doesnt show placeholder view anymore
My app is an authenticated application. So I only show widget views only when user logs in. In earlier beta versions of Xcode, prior to Xcode 12 GA, on passing nil timeline entires with reload policy of never, the system used to show placeholder view. But now I don’t see that. When we are passing nil entires in timeline method the widget view is completely black. Need help to show placeholder view until the app is authenticated. Any answer from anyone would be very helpful. Currently using Xcode 12.1
0
0
507
Nov ’20
WidgetKit remove existing posted timelines
Hi Our application is a session based application. So until the user has not been authenticated on the main app, depending on the group container UserDefaults, we are passing zero timelines and the reload policy as .never. But once user authenticates on the main application, we are setting session enabled in group container user defaults and issuing a reloadTimelines call. As our application is related to banking and wallets, so we are passing transactions related data to these timeline entries. But if user decides to logout, our due to some reason if a re-authentication is required, then how do we remove the already passed timelines. Currently WidgetCenter doesn't have any API's regarding this. Can we get any information on this issue of removing the timeline entries. Any future plans on this? Maybe something line removing entries of a kind.
0
0
718
Aug ’20
WidgetKit API availability for posting from main app
Hi. I have a widget designed which basically has to authenticate the user. As a result, during the creation of widget, I am passing empty entries to the widget and passing a reload polity of never. This scenario now just shows redacted views. I have seen the WWDC video Meet WidgetKit explaining that widget can awaken from the main app when. Guessing this to be providing timelines entries from main app, how do I do this? There is no documentation explaining the scenario of communication between main app and widgets and neither are there any videos relating to this. Also the video hints at scheduling updates at a certain time from extension, does this mean initial Widget extension or Intents Extension? Any info on these queries would be very helpful as developers would love to have their app driving the widget and not the other way around.
1
0
752
Aug ’20
WidgetKit development issue with Xcode 12 beta 4 using Intents
I am having issues developing and validating for WidgetKit. I am trying to validate for IntentConfiguration and when I try to create a new custom Intent in the already Xcode generated intentdefinition's file, the class generation is failing behind the scenes I guess. CustomIntent.swift file, when I am using this dependency, Xcode build is not able to find this class. MyCustomIntent.swift class file is not getting generated and I am not able to create my own intents, leading to modifying the existing ConfigurationIntent.swift by creating a new project and thereby using generated intentdefinitions file for development. Also when developing for Dynamic Intents, we cannot proceed further as, even though I am able to modify the Xcode generated new project Intentdefinition file, but when I make this Intent type to use dynamic types, there is another issue with code generation. Dynamic types Intent variables protocol methods code is not getting generated in the DynamicIntent swift class file, due to which there is zero scope to proceed in this direction. Overall, Static configuration can help developers for a mere UI check majorly. Most of the work all depends on background fetch using dynamic type. Please help on at least the code generation part for dynamic type protocol methods : provide<Type>CollectionForDynamicConfiguration in the intent handlers protocols.
2
0
2.0k
Aug ’20
Displaying a custom swift view in widget kit
I have a view in swift(UIKit). I have converted this view to UIViewRepresentable and this I have used in swiftUI and my UIKIt view is visible in it. import SwiftUI struct ContentView: View {     var body: some View {         VStack {             Text("Hello, world!").padding()             Text("This is root content view") MyViewRepresentable()         }     } } This above swiftUI contentView is working fine while showing in the application form. But when I try the same in Widgets, the application is getting crashed. I am getting the following error : Fatal error: PlatformViewRepresentableAdaptor<MyViewRepresentable>: file /Library/Caches/com.apple.xbs/Sources/ChronoSim/Chrono-63.5/WidgetKit/SPI/WidgetViewArchive.swift, line 254 2020-07-08 12:45:31.402597+0530 TestSwiftWidgetExtension[24779:632349] Fatal error: PlatformViewRepresentableAdaptor<MyViewRepresentable>: file /Library/Caches/com.apple.xbs/Sources/ChronoSim/Chrono-63.5/WidgetKit/SPI/WidgetViewArchive.swift, line 254
2
0
792
Jul ’20
Launchscreen storyboard with launch images
Apple has made it mandatory to use launch screen storyboards by April 2020. If not done so, the app store submissions would get rejected.This is not a big deal. We can create a storyboard and use the same as the launch screen storyboard. But what I wanted to know is that I wanted to use a full-screen image view on this storyboard, and use the launch screen images as a source for image view.The problem with this is that these launch images are different for different resolutions. For example, iPhone 8/7/6 uses a 667-height/scale-2 resolution image and iPhone SE uses a 568-height/scale-2 image. The appropriate image can be set for the running device target and get the desired launch screen image for the launch storyboard image view and get the splash screen running. But while generating an IPA, the launch screen image does not act dynamically and the image view could not use the appropriate launch screen.The above issue can be solved by using a custom class for the UI element, but the launch storyboard doesn’t support the concept of custom classes for these elements.What can be done to use the old generated splash launch images to be used on a launch screen storyboard? Any suggestions would be helpful.
2
0
4.0k
Jan ’20