Parse-SDK-iOS-OSX icon indicating copy to clipboard operation
Parse-SDK-iOS-OSX copied to clipboard

Important changes for ReadMe and Docs in upcoming SwiftUI changes.

Open noobs2ninjas opened this issue 5 years ago • 2 comments

For the upcoming Swift 5.3/XCode 12. SwiftUI applications by default will no longer have an app delegate. Instead, this is what is created by default.

@main
struct Xcode12TestApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

Since Apple is now pushing to use purely SwiftUI and move away from UIKit including storyboard and controllers. I feel we need to do some testing on how to initialize Parse, ParseFacebookUtils, and ParseTwitterUtils to work with SwiftUI. We then need to update our docs and ReadME, the later of which is way overdue for an update anyway..

noobs2ninjas avatar Jun 25 '20 06:06 noobs2ninjas

In my tinkering, the following works just fine for initializing Parse in a pure-SwiftUI app:

import Parse
import SwiftUI

@main
class Xcode12TestApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }

    required init() {
        let config = ParseClientConfiguration { … }
        Parse.initialize(with: config)
    }
}

jbhannah avatar Jul 06 '20 21:07 jbhannah

Thanks @jbhannah for doing that! That is seriously helpful.

I think the most important thing is that we test facebook initialization and how it works within facebook utils. I'm betting we need to add documentation explaining that using a @main class will not work and an @UIApplicationMain app delegate will be required in order to initialize facebook and handle URI callbacks properly when being routed back to the application after logging in.

noobs2ninjas avatar Jul 07 '20 20:07 noobs2ninjas