Repository navigation
chore: deprecate APIs that 4.0 hides or removes - #884
Merged
Merged
Conversation
Deprecate PostHogSessionManager.shared, setSessionId(_:), dateToMillis(_:), imageToBase64(_:_:) and UIColor.hexDescription(_:). None of them is used inside the SDK, so the annotations add no warnings to the SDK's own build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dustinbyrne
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
PostHog iOS 4.0 hides or removes several public APIs (#874) and raises the minimum iOS version to 15 (#876). Most of those APIs were never marked deprecated. This adds deprecation warnings in 3.x where that can be done without side effects, so app developers hear about the change before it breaks their build.
Deprecated, with a compiler warning:
PostHogSessionManager.shared,setSessionId(_:)PostHogSDK.getSessionId(),startSession(),endSession()dateToMillis(_:)Int64(date.timeIntervalSince1970 * 1000)imageToBase64(_:_:)UIColor.hexDescription(_:)None of these is used inside the SDK, so the SDK's own build gains no warnings. Annotations only; behaviour is unchanged.
Changing in 4.0 without a 3.x warning
The SDK calls these internally. Deprecating them in place makes Swift warn at every internal call site, which was 171 warnings in the SDK's own macOS build, and CocoaPods users compile the SDK from source and would see them. Warning only external callers would need internal forwarders and about 110 renamed call sites. They are listed in the changeset instead, so the 3.x changelog still announces them.
postHogSdkName,postHogVersion,PostHogConfig.storageManager,PostHogConfig.snapshotEndpointtoISO8601String(_:),toISO8601Date(_:),sanitizeDictionary(_:),deleteSafely(_:),postHogiOSSdkName,UIColor.init(hex:),Gzip,GzipError,CompressionLevel,ReachabilityErrorThe iOS 15 minimum is also announced in the changeset only, since Swift cannot warn about an app's deployment target at compile time.
Wrapper SDKs
No wrapper treats warnings as errors, so nothing breaks.
PostHogSessionManager.shared.setSessionId.dateToMillisandimageToBase64.@_spi(PostHogInternal), which keeps these available in 4.0 but doesn't silence the warning on 3.x.💚 How did you test it?
make buildSdk: all seven builds pass (iOS, SwiftPM macOS, macOS, Mac Catalyst, tvOS, watchOS, visionOS), with no deprecation warnings from the SDK module.make test(macOS): the first full run had one failure,activates survey when event name and properties match(PostHogSurveysTest.swift:688).PostHogSurveysTestthen passed 3 of 3 runs on this branch and 3 of 3 onmain, and a second full run passed (910 tests). This PR changes no survey logic, only a deprecation attribute onUIColor.hexDescription(_:).make apiCheck: snapshot up to date.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileThe changeset is
minorand was written by hand in the changeset format.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Gzip,GzipError,CompressionLevelandReachabilityErrorare not deprecated: no public API accepts or returns them, and warning about them would mean restructuring the bundled third-party code.🤖 Generated with Claude Code