.llms/skills/public-api-design.md
The SDK is migrating from Objective-C to Swift. New public APIs that involve
Swift-only types (enums with associated values, Result, structs) must follow
the dual-interface pattern established by LoginManager.logIn():
@nonobjc, using Swift-native types@available(swift, obsoleted: 0.1) and
@objc(selectorName:), using ObjC-bridgeable types ((Type?, Error?) -> Void)// MARK: - Swift API (preferred)
@nonobjc
public func logIn(
viewController: UIViewController? = nil,
configuration: LoginConfiguration?,
completion: @escaping LoginResultBlock // Swift-only LoginResult enum
) {
commonLogIn(/* ... */)
}
// MARK: - ObjC API (legacy-compatible)
@available(swift, obsoleted: 0.1)
@objc(logInFromViewController:configuration:completion:)
public func logIn(
from viewController: UIViewController?,
configuration: LoginConfiguration?,
completion: @escaping (LoginManagerLoginResult?, Error?) -> Void
) {
commonLogIn(/* ... */)
}
// MARK: - Shared Implementation
private func commonLogIn(/* ... */) {
// Core logic here
}
Reference: FBSDKLoginKit/FBSDKLoginKit/LoginManager.swift:128-199
public and part of the SDK's external API surface@objc-annotated (like LoginManager)@objc enums with Int raw values,
NSObject subclasses)Package.swift| Annotation | Purpose |
|---|---|
@nonobjc | Hides the method from ObjC callers |
@available(swift, obsoleted: 0.1) | Hides the method from Swift callers |
@objc(selectorName:) | Exposes the method to ObjC with a specific selector |