-
Notifications
You must be signed in to change notification settings - Fork 71
feat: Create separate Swift target and move MPLog there #517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
denischilik
merged 21 commits into
workstation/9.0-Release
from
feat/SDKE-823-Create-separate-swift-target-and-move-SceneDelegateHandler-there-2
Jan 26, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b7eff59
feat: Fix podspec default subspec and update Podfile deployment target
denischilik 8bb980b
Add Swift target and move SceneDelegateHandler
denischilik 01cf129
Move MPLogger to Swift target and update references
denischilik 738dd30
Add Swift podspec and configure dependencies
denischilik 974fc7f
Add mParticle_Apple_SDK_Swift.xcframework to artifacts and Tuist depe…
denischilik de192f4
fix linter commants
denischilik bef234d
Remove unused file
denischilik cf9d396
Fix linter comments
denischilik 0175091
Swift target should support both platforms iOS and AppleTV
denischilik 6df8fd9
Update version to match SDK version
denischilik d552808
Include local podspec
denischilik 81a433a
Merge branch 'workstation/9.0-Release' into feat/SDKE-823-Create-sepa…
denischilik 39e4a4a
MPLogLevel is part of public API we need to map between Swift and obj…
denischilik df08e93
We should import Swift code only in *.m files
denischilik 9f2724d
Update imports to Internal so that Swift header should be private
denischilik 2193289
No needs to build Swift target
denischilik a859e8d
Fix MPDevice
denischilik 9aab465
Remove commented code
denischilik 6a83abc
Cleanup script
denischilik db72fc8
Fix forced unwrap
denischilik 60d26dc
Remove empty file
denischilik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import Foundation | ||
|
|
||
| /// Log Levels | ||
| @objc | ||
| public enum MPILogLevelSwift: UInt { | ||
| /** No log messages are displayed on the console */ | ||
| case none = 0 | ||
| /** Only error log messages are displayed on the console */ | ||
| case error | ||
| /** Warning and error log messages are displayed on the console */ | ||
| case warning | ||
| /** Debug, warning, and error log messages are displayed on the console */ | ||
| case debug | ||
| /** Verbose, debug, warning, and error log messages are displayed on the console */ | ||
| case verbose | ||
| } | ||
|
|
||
| @objcMembers | ||
| public class MPLog: NSObject { | ||
| public var logLevel: MPILogLevelSwift | ||
| public var customLogger: ((String) -> Void)? | ||
|
|
||
| public init(logLevel: MPILogLevelSwift) { | ||
| self.logLevel = logLevel | ||
| } | ||
|
|
||
| public static func from(rawValue: UInt) -> MPILogLevelSwift { | ||
| return MPILogLevelSwift(rawValue: rawValue) ?? .none | ||
| } | ||
|
|
||
| private func log(loggerLevel: MPILogLevelSwift, format: String, arguments: any CVarArg...) { | ||
| if logLevel.rawValue >= loggerLevel.rawValue && loggerLevel != .none { | ||
| let msg = String.localizedStringWithFormat("mParticle -> \(format)", arguments) | ||
| if let customLogger = customLogger { | ||
| customLogger(msg) | ||
| } else { | ||
| NSLog(msg) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public func error(_ message: String) { | ||
| log(loggerLevel: .error, format: message) | ||
| } | ||
|
|
||
| public func warning(_ message: String) { | ||
| log(loggerLevel: .warning, format: message) | ||
| } | ||
|
|
||
| public func debug(_ message: String) { | ||
| log(loggerLevel: .debug, format: message) | ||
| } | ||
|
|
||
| public func verbose(_ message: String) { | ||
| log(loggerLevel: .verbose, format: message) | ||
| } | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Pod::Spec.new do |s| | ||
| s.name = "mParticle-Apple-SDK-Swift" | ||
| s.version = "8.41.1" | ||
| s.summary = "mParticle Apple SDK Swift components." | ||
|
|
||
| s.description = <<-DESC | ||
| Swift components for the mParticle Apple SDK. | ||
| This pod contains Swift-only code that is used by the main mParticle-Apple-SDK. | ||
| DESC | ||
|
|
||
| s.homepage = "https://www.mparticle.com" | ||
| s.license = { :type => 'Apache 2.0', :file => '../LICENSE'} | ||
| s.author = { "mParticle" => "support@mparticle.com" } | ||
| s.source = { :git => "https://github.com/mParticle/mparticle-apple-sdk.git", :tag => "v" + s.version.to_s } | ||
| s.documentation_url = "https://docs.mparticle.com/developers/sdk/ios/" | ||
| s.requires_arc = true | ||
| s.module_name = 'mParticle_Apple_SDK_Swift' | ||
| s.ios.deployment_target = "15.6" | ||
| s.tvos.deployment_target = "15.6" | ||
| s.swift_versions = ["5.0"] | ||
|
|
||
| s.source_files = 'Sources/**/*.swift' | ||
| end |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.