تخطَّ إلى المحتوى

iOS (Swift)

التثبيت

في Xcode: File ← Add Package Dependencies ← https://github.com/heysada/sada-ios، ثم أضف مكتبة HeysadaNida إلى هدف تطبيقك.

حزمة Swift واحدة تضم كل حزمنا، فلها إصدار واحد لكل المنتجات: تُحدَّث معاً. وكل مكتبة تربط الملف الثنائي نفسه HeysadaKit، فـالتطبيق يحمل شيفرة كل المنتجات أياً كانت المكتبات التي يستعملها (تطبيق iOS لا يحمل إلا بيئة Kotlin واحدة، فتشترك المنتجات في إطار واحد).

شرح الاستخدام أدناه بالإنجليزية، كما يظهر في سجل الحزمة، والشيفرة نفسها في كل لغة.

The in-app messages SDK for iOS: SwiftUI over the Kotlin Multiplatform SDK, which draws every format (splash, stories, carousel, countdown, coupon, lucky draw, floating button, toast, daily check-in) from the app’s design.

Use it

import HeysadaNida

await NidaApp.configure(appKey: "ipk_…", apiUrl: "https://…", placements: ["home_top", "home_popup"],
                        onOpenUrl: { url, _ in UIApplication.shared.open(url) })
await NidaApp.identify(user.id, userHash: user.hash)

ContentView()
    .nidaMessages()                       // popups, splashes and stories over the app

NidaBanner(placement: "home_top")         // a banner where it sits
    .frame(height: 140)

NidaStoriesRow(placement: "home_stories") // a stories placement: its row of rings
    .frame(height: 96)                    // a ring opens the viewer over the app (.nidaMessages())

await NidaApp.event("add_to_cart")        // messages set to show when this happens

// The AppDelegate's push callbacks:
await NidaApp.registerAPNs(deviceToken: token, sandbox: isDebugBuild)
await NidaApp.handlePush(userInfo: response.notification.request.content.userInfo)

The server decides every claim, play and check-in; the SDK draws the view the service sends back with the result. Pushes are sent with the org’s own APNs key or Firebase project, which the org sets in the panel’s settings.

Develop

./check.sh    # builds the KMP XCFramework, runs the Swift tests on an iOS simulator