Все коллекции
Onboarding.Online SDK integration
Manual for adding swift-onboarding-sdk to the existing project. UI interface - SwiftUI
Manual for adding swift-onboarding-sdk to the existing project. UI interface - SwiftUI
В
Автор: Валерия Зимницкая
Обновлено больше недели назад
  1. Open the required project and go to the dependency settings: “Project -> Package dependency”

    1.1 Click the “+” (Add package dependency) button.

  2. You will see the “Apple swift packages” window.

    Paste the link https://github.com/onboarding-online/swift-onboarding-sdk in the “Search or Enter Package URL” field.

  3. Xcode will show the settings for adding SDK. Make sure the settings look like this “Dependency rule -> branch : main” and click the “Add package” button.

  4. You will see the library verification window. Wait till the verification ends and click “Add package.”

    The package integration has been completed. Only a few code lines remain to be added to your project!

  5. If you use Interface -> SwiftUI (Point 6) for the project initializing:
    12.1. Open the ContentView file (or wherever you want to add an onboarding launcher: ScreenService).
    12.2 Add to the file header the following:
    import OnboardingiOSSDK
    12.3 Find the structure:
    struct ContentView: View {

    }

    12.4 Add the piece of code to it:
    func startOnboarding() {

    OnboardingService.shared.startOnboarding(projectId: "",

    localJSONFileName: "",

    useLocalJSONAfterTimeout: 1.0)

    { onboardingResults in

    print(onboardingResults)

    }

    }

    12.5 Add a call to the screen constructor:
    var body: some View {

    VStack {

    Image(systemName: "globe")

    .imageScale(.large)

    .foregroundColor(.accentColor)

    Text("Hello, world!")

    }

    .onAppear(perform: startOnboarding)

    .padding()

    }

  6. If you have already obtained an onboarding.online service project, download the json file of your onboarding Onboarding.online-> project -> onboarding -> json

  7. Drag the file into your Xcode project. After that, a settings window for adding a file will appear.

  8. Select "Copy if needed," "Create groups" and click "Finish."

  9. Add the file name to the onboarding launch function:
    16.1 Open the "ContentView" file (or wherever you want to add an onboarding launcher: ScreenService);
    16.2 Add the name of the json file you have downloaded.

  10. Click the run button, wait for the simulator to launch, and enjoy your first onboarding!

Нашли ответ на свой вопрос?