https://github.com/carlosmonzon/segmentmultiplatform
Segment analytics wapper in Kotlin Multiplatform
https://github.com/carlosmonzon/segmentmultiplatform
kotlin kotlin-multiplatform kotlin-multiplatform-mobile
Last synced: 4 months ago
JSON representation
Segment analytics wapper in Kotlin Multiplatform
- Host: GitHub
- URL: https://github.com/carlosmonzon/segmentmultiplatform
- Owner: carlosmonzon
- Created: 2022-07-23T14:35:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T12:04:51.000Z (almost 3 years ago)
- Last Synced: 2025-06-20T12:50:28.235Z (6 months ago)
- Topics: kotlin, kotlin-multiplatform, kotlin-multiplatform-mobile
- Language: Objective-C
- Homepage:
- Size: 1.41 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Segment multiplatform (experimental)
Current support for iOS and Android only
## iOS
### Create Swift Package
```
./gradlew createSwiftPackage
```
Look at directory `swiftpackage`
Current package is pushed to a separate repository: https://github.com/carlosmonzon/SegmentMultiplatformPackage
```
./gradlew assembleXCFramework
```
Look at directory `/build/XCFramework`
## Segment Framework
Current approach uses Segment framework with cinterop which follows kotlin multiplatform guide to add a framework
without cocoapods
https://kotlinlang.org/docs/multiplatform-mobile-ios-dependencies.html#add-a-framework-without-cocoapods
When trying to use segment as a cocoapods dependency I found some issues related to Segment headers
containing `@import Foundation;` instead of `#import ` which I couldn't resolve, hence adding
the Segment framework
### How to replace the Segment.xcframework native resource? (Current version 4.1.6)
Download https://github.com/segmentio/analytics-ios
Download script: https://gist.github.com/carlosmonzon/0b775d3aa15d9d0d5c05194515c90f8f and put it in the segment root
folder
Run the script and `Segment_XCFramework` will be created. Replace the content inside
the `SegmentMultiplatform/src/nativeInterop/cinterop/Segment`
## Android
### Publish to Maven Local
Run the following command to publish the artifacts to local maven
```
./gradlew publishToMavenLocal
```
### Add android dependency to project
```kotlin
implementation("org.monzon:SegmentMultiplatform-android::${version}")
```