Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let package = Package(
name: "OptableSDK",
dependencies: [],
path: "Source",
exclude: ["Info.plist"]),
exclude: ["Info.plist", "Public/ObjCSupport"]),
.testTarget(
name: "OptableSDKTests",
dependencies: ["OptableSDK"],
Expand Down
38 changes: 0 additions & 38 deletions Source/OptableSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,6 @@ public extension OptableSDK {
}
})
}

// MARK: Objective-C support
/**
This is the Objective-C compatible version of the `identify(ids, completion)` API.

Instead of completion callbacks, delegate methods are called.
*/
@objc
func identify(_ ids: [OptableSDKIdentifier]) throws {
let bridgedIds = ids.compactMap({ OptableIdentifier(objc: $0) })
try self._identify(bridgedIds) { result in
switch result {
case let .success(response):
self.delegate?.identifyOk(response)
case let .failure(error as NSError):
self.delegate?.identifyErr(error)
}
}
}
}

// MARK: - Targeting
Expand Down Expand Up @@ -177,25 +158,6 @@ public extension OptableSDK {
}
})
}

// MARK: Objective-C support
/**
This is the Objective-C compatible version of the `targeting(completion)` API.

Instead of completion callbacks, delegate methods are called.
*/
@objc
func targeting(_ ids: [OptableSDKIdentifier]) throws {
let bridgedIds = ids.compactMap({ OptableIdentifier(objc: $0) })
try self._targeting(ids: bridgedIds, completion: { result in
switch result {
case let .success(optableTargeting):
self.delegate?.targetingOk(optableTargeting)
case let .failure(error as NSError):
self.delegate?.targetingErr(error)
}
})
}
}

// MARK: - Witness
Expand Down
49 changes: 49 additions & 0 deletions Source/Public/ObjCSupport/OptableSDK+ObjC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// OptableSDK+ObjC.swift
// OptableSDK
//
// Copyright © 2026 Optable Technologies, Inc. All rights reserved.
//

import Foundation

// MARK: Objective-C support

public extension OptableSDK {

/**
This is the Objective-C compatible version of the `identify(ids, completion)` API.

Instead of completion callbacks, delegate methods are called.
*/
@objc
func identify(_ ids: [OptableSDKIdentifier]) throws {
let bridgedIds = ids.compactMap({ OptableIdentifier(objc: $0) })
try self._identify(bridgedIds) { result in
switch result {
case let .success(response):
self.delegate?.identifyOk(response)
case let .failure(error as NSError):
self.delegate?.identifyErr(error)
}
}
}

/**
This is the Objective-C compatible version of the `targeting(completion)` API.

Instead of completion callbacks, delegate methods are called.
*/
@objc
func targeting(_ ids: [OptableSDKIdentifier]) throws {
let bridgedIds = ids.compactMap({ OptableIdentifier(objc: $0) })
try self._targeting(ids: bridgedIds, completion: { result in
switch result {
case let .success(optableTargeting):
self.delegate?.targetingOk(optableTargeting)
case let .failure(error as NSError):
self.delegate?.targetingErr(error)
}
})
}
}
Loading