First Steps with SwiftUI

iOS Classic - First Steps with SwiftUI

📍

This page describes how to install Taboola dependencies in your SwiftUI project.

While reading the documentation, take a look at our Sample App.

Add the Taboola SwiftUI Umbrella package

📘

The Taboola SwiftUI Umbrella package provides pre-built SwiftUI components that simplify the integration.

Using your preferred method, add the Taboola SwiftUI Umbrella package:

Method I:

  1. In Xcode, select File > Add Package Dependencies...

    A modal dialogue displays.

  2. In the search box (top, right), enter the URL: <<spm_url>>.

    Information about the Taboola SDK package is shown.

  3. Select a Dependency Rule (top, right) - e.g. Up To Next Major Version.
  4. Click on Add Package (bottom, right).

    The package tree displays in the Project navigator pane, under Package Dependencies.

Method II:

Add the dependency to Package.swift - e.g.:

dependencies: [
    .package(url: "<<spm_url>>", .upToNextMajor(from: "<<iosV4Version>>"))
]

The package tree

The Taboola SwiftUI Umbrella package provides pre-built SwiftUI components that simplify the integration. Take a moment to review them in the Project navigator pane:

Note the following components:

  • ClassicUnitSwiftUI - A SwiftUI wrapper for Classic SDK placements
  • WebUnitSwiftUI - A SwiftUI wrapper for Web SDK placements
  • NativeUnitSwiftUI - A SwiftUI wrapper for Native SDK placements
  • Protocols and Helpers - Supporting types for integration

Add the skAdNetwork ID

Edit Info.plist in a text editor and add the skAdNetwork ID for Taboola:

<key>SKAdNetworkItems</key>
	<array>
		<dict>
			<key>SKAdNetworkIdentifier</key>
			<string>p4ybsjem3u.skadnetwork</string>
		</dict>
	</array>

💁🏻

Need a hand?

Go ahead! Ask a question in our Support Forum.

Tip: Provide as much detail as possible, including your platform and SDK version.