-
Notifications
You must be signed in to change notification settings - Fork 331
Bootstrapping Integrations
Prateek Srivastava edited this page Nov 10, 2015
·
12 revisions
iOS integrations are very flexible, you need to simply implement a few protocols and users can start using your integration. We recommend developing your integrations in tandem with your own library as a CocoaPods subspec.
Alternatively, you use this guide to bootstrap your integration in it's own repo. You use our Mixpanel integration as an example.
- Run
pod lib create Segment-{Service}
Replace `{Service} with your own service name, e.g. Mixpanel or Flurry.
- You can select either Objective-C (recommended) or Swift. If you use Swift, be sure to document any additional steps required by users to integrate your library into their app.
- Creating a demo app is optional, but recommended for manual testing.
- Any testing framework is fine.
- Skip view based testing.
- Pick a three letter class prefix (for Objective C only). Ideally the same one that you are already using for your own library.
- Add dependencies to your generated Podspec.
https://cloudup.com/cHMTrZYg7DN
The first command will generate a file Segment-{Service}.podspec
. You'll need to add 2 dependencies in this file.
- The Analytics library dependency:
s.dependency 'Analytics', '~> 3.0.1-alpha'
. Remember to specify the minimum version of the Analytics library you need. - Your own library dependency, e.g. :`s.dependency 'Mixpanel', '~> 2.9.0'
- Add a Makefile. Remember to replace
PROJECT := Segment-{Integration}
with your own service.
XCPRETTY := xcpretty -c && exit ${PIPESTATUS[0]}
SDK ?= "iphonesimulator"
DESTINATION ?= "platform=iOS Simulator,name=iPhone 5"
PROJECT := Segment-{Integration}
XC_ARGS := -scheme $(PROJECT)-Example -workspace Example/$(PROJECT).xcworkspace -sdk $(SDK) -destination $(DESTINATION) ONLY_ACTIVE_ARCH=NO
install: Example/Podfile Segment-Mixpanel.podspec
pod install --project-directory=Example
clean:
xcodebuild $(XC_ARGS) clean | $(XCPRETTY)
build:
xcodebuild $(XC_ARGS) | $(XCPRETTY)
test:
xcodebuild test $(XC_ARGS) | $(XCPRETTY)
xcbuild:
xctool $(XC_ARGS)
xctest:
xctool test $(XC_ARGS)
.PHONY: test build xctest xcbuild clean
.SILENT:
-
Update your deployment targets for the test app and the integration to 8.0 in Xcode.
-
Clear your framework search paths.
-
Run
make test
ormake xctest
to verify everything is working!