Post

Replies

Boosts

Views

Activity

Reply to Targets vs Library
For option 2... ...you could consider using Swift Package Manager, to make a number of separate self-contained modules. Each App would be it's own Xcode project, and could include whichever Swift Packages it requires. Of course, you could use a single Swift Package, for all the shared code. But I would lean towards using a number of packages, each with a clearly-defined purpose. I find the modular approach cleaner, and easier to maintain.
Mar ’22
Reply to ATTrackingManagerAuthorization Not showing
Tip: To help people understand your code, paste it into a code block (using "Paste and Match Style") -(void)viewDidLoad { UIApplication *applicaiton = [UIApplication sharedApplication]; if (applicaiton.applicationState == UIApplicationStateActive) { if (@available(iOS 14, *)) { ATTrackingManagerAuthorizationStatus status = [ATTrackingManager trackingAuthorizationStatus]; if (status == ATTrackingManagerAuthorizationStatusNotDetermined) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { // Tracking authorization completed. Start loading ads here. [[NSOperationQueue mainQueue] addOperationWithBlock:^ { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; }]; }]; } } else { [[GADMobileAds sharedInstance] startWithCompletionHandler:nil]; // Fallback on earlier versions } } [super viewDidLoad]; } Did you add the NSUserTrackingUsageDescription key to your info.plist? e.g. <key>NSUserTrackingUsageDescription</key> <string>$(PRODUCT_NAME) needs access to tracking information.</string> Also, it's probably best not to put the tracking request in your viewDidLoad, as the UI hasn't finished laying-out at this point. Might be better to have it in viewDidAppear, or on a button action. Also Also... The system-permission alert will only show when the app’s tracking authorization status is .notDetermined Once the authorization status is set, calling the function will just trigger the completion handler without showing the alert The alert will not be displayed if “Allow Apps to Request to Track” is turned off in the system privacy settings
Mar ’22
Reply to Managing local notifications
the notification is sent each time the user goes to the view controller. The notification is scheduled in viewDidLoad. This suggests that when you leave firstViewController, it is destroyed. So when you re-visit it, it is recreated, and the notification is scheduled again. You don't include the supporting code, showing how firstViewController is instantiated... ... so you could either: Keep firstViewController in memory, so it is not repeatedly created and destroyed or Save a Bool flag somewhere permanent (e.g. in your Data Model, or in the calling ViewController), to record that the notification has been scheduled (and test this flag, before scheduling the notification) Tip: the class "firstViewController" should really be named with a capital first letter: "FirstViewController"
Mar ’22
Reply to PreviewProvider view initializer compiler error
For a more general solution, in your PreviewProvider: create an instance of the type you are using (Root) configure it (if necessary) pass it to RootView struct RootView_Previews: PreviewProvider { static var previews: some View { let root = Root()         /// configure root, if necessary, e.g. root.register = 5         return RootView(rootToView: root) } }
Mar ’22