mirror of
https://github.com/BillyOutlast/posthog.com.git
synced 2026-02-04 03:11:21 +01:00
* split ios sdk pages * Update contents/docs/libraries/ios/index.mdx Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * review comments * Autocapture, config table * Apply suggestion from @ivanagas Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> * Unique import names * Address comments --------- Co-authored-by: Ian Vanagas <34755028+ivanagas@users.noreply.github.com> Co-authored-by: Eli Kinsey <eli@ekinsey.dev>
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
import Tab from "components/Tab"
|
|
import IOSUIKit from "./code-variants/ios-uikit.mdx"
|
|
import IOSSwiftUI from "./code-variants/ios-swiftui.mdx"
|
|
|
|
PostHog is available through [CocoaPods](http://cocoapods.org) or you can add it as a Swift Package Manager based dependency.
|
|
|
|
### CocoaPods
|
|
|
|
```ruby file=Podfile
|
|
pod "PostHog", "~> 3.0"
|
|
```
|
|
|
|
### Swift Package Manager
|
|
|
|
Add PostHog as a dependency in your Xcode project "Package Dependencies" and select the project target for your app, as appropriate.
|
|
|
|
For a Swift Package Manager based project, add PostHog as a dependency in your `Package.swift` file's Package dependencies section:
|
|
|
|
```swift file=Package.swift
|
|
dependencies: [
|
|
.package(url: "https://github.com/PostHog/posthog-ios.git", from: "3.0.0")
|
|
],
|
|
```
|
|
|
|
and then as a dependency for the Package target utilizing PostHog:
|
|
|
|
```swift file=Package.swift
|
|
.target(
|
|
name: "myApp",
|
|
dependencies: [.product(name: "PostHog", package: "posthog-ios")]),
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Configuration is done through the `PostHogConfig` object. Here's a basic configuration example to get you started.
|
|
|
|
You can find more advanced configuration options in the [configuration page](/docs/libraries/ios/configuration).
|
|
|
|
<Tab.Group tabs={['App Delegate/UIKit', 'SwiftUI Lifecycle']}>
|
|
<Tab.List>
|
|
<Tab>UIKit</Tab>
|
|
<Tab>SwiftUI</Tab>
|
|
</Tab.List>
|
|
<Tab.Panels>
|
|
<Tab.Panel>
|
|
{IOSUIKit}
|
|
</Tab.Panel>
|
|
<Tab.Panel>
|
|
{IOSSwiftUI}
|
|
</Tab.Panel>
|
|
</Tab.Panels>
|
|
</Tab.Group> |