SwiftUI Life-cycle iOS14

Please can you tell me how to implement the Backendless app initialization in the new SwiftUI Life Cycle for iOS 14.

There is no equivalent to below

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Backendless.shared.initApp(applicationId: “YOUR-APPLICATION-ID”, apiKey: “YOUR-APPLICATION-IOS-API-KEY”)
return true
}

Thank you

Hello @Stewart_Hall

Unfortunately we do not support iOS 14 until the official release.

Regards, Inna

Hi

Have you got any examples / tutorials for SwiftUI Life0cycle iOS14 please?

Thanks

Stew

@olhadanylova, could you please look into it? (see the original question for the topic)

1 Like

I now have this working and will be testing over the coming days.

Kind regards

Stew

Hi, @Stewart_Hall

If you have any issues with this again you can always write us. We will be happy to assist you.

Regards,
Marina

Hey,

I’m also to know if a SwiftUI tutorial has been completed utilising Backendless. I’m currently re-skilling and trying to identify if its worth pursuing or not.

Jeremy

Hello @Jeremy_Watson,

Could you please clarify, what problems do you experience with Backendless using SwiftUI?
Backendless initialisation can still be called from the AppDelegate class:

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        initBackendless()
        return true
    }
    
    private func initBackendless() {
        Backendless.shared.hostUrl = "https://api.backendless.com"
        Backendless.shared.initApp(applicationId: "YOUR APP ID", apiKey: "YOUR IOS API KEY")        
    }
    ...
    ...
}

and Swift code for calling Backendless methods is the same, e.g:

func testMethod() {
    Backendless.shared.data.ofTable("Person").findFirst(responseHandler: { person in
        print("First Person: \(person)")
    }, errorHandler: { fault in
        print("Error: \(fault.message ?? "")")
    })
}

Regards,
Olha

Hi @olhadanylova,

Thank you for your quick response. I’m just investigating if it works and if it behaves any differently. I found an example of the connection through the App Delegate (as you said) and it had some issues from a previous example. I also noticed that the POD has two references when you import i.e.

import Backendless
vs
import Backendless-Swift

But I’ll review your example with detail today. Thank you.

Awesome stuff.

Jeremy

Hello,

Please use the BackendlessSwift one.
SwiftUI framework has some differences but it shouldn’t affect on the Backendless library performance.

Regards,
Olha

Hi Olha,

Thank you again. Yeah I ended up having to destroy the a current working of the project as I had no idea what XCode did. I decided to use the SDK directly from GitHub which seems to be working and not throwing errors about not finding Backendless. Furthermore I can see the BackendlessSwift one as you suggested is in the framework. Happy Days.

Has backendless done any videos on SwiftUI/5 and Backendless? I see allot of videos for others but only a couple for older versions of Swift/

Thank you again Olha.

Cheers,
Jeremy

1 Like

Hello Jeremy,

Glad it is working for you now :slightly_smiling_face:
Unfortunately we don’t have video tutorials for iOS development, but we will try to help you if you suddenly have any questions or need some help with Backendless.

Regards,
Olha