amplitude / Amplitude-iOS

Native iOS/tvOS/macOS SDK
MIT License
303 stars 193 forks source link

How can I disable tracking in Swift? #459

Closed wlxo0401 closed 1 year ago

wlxo0401 commented 1 year ago

Summary

스크린샷 2023-08-04 오후 7 10 28

My project is Swif.

However, only Objective-C is available for how to use Disable tracking.

How can I apply it in Swift as well?? Or are there any related documents?

The code I want to do with Swift is below.

import "AMPTrackingOptions.h"

AMPTrackingOptions *options = [[[[AMPTrackingOptions options] disableLatLng]; [[Amplitude instance] setTrackingOptions:options];

yuhao900914 commented 1 year ago

Hi @wlxo0401, Thanks for using amplitude. I added the swift example in the doc. It will be merged and released soon. Also sharing the snippet here.

            let trackingOptions = AMPTrackingOptions().disableCity().disableCarrier();
            Amplitude.instance().setTrackingOptions(trackingOptions!);

Closing this issue. Feel free to reopen this if you still have issues. Thanks.

yuhao900914 commented 1 year ago

Just want to share with you. We have a new iOS SDK which is developed using swift. It will be GA soon. And this is the SDK we are going to deprecate. Read more. There has been a lot of improvement in the latest iOS SDK. Please take a look at here. More information related to the latest architecture.