RateM
RateM

Reputation: 291

How to obfuscate swift code for cocoa pods

I have created a pod library. But my code in the library is completely visible when imported. How can I hide the content of code and just show signatures?

It should be something like this.

import Foundation
import WebKit
import UIKit
import SafariServices

internal enum SdkErrorCode : String {

    case INITIALIZATION_PENDING

    case OPERATION_IN_PROGRESS
}

public class XYZ : NSObject, SFSafariViewControllerDelegate {

    public func safariViewControllerDidFinish(_ controller: SFSafariViewController)

    public func setUserCloseCallback(cb: (() -> ())?)

    public func setResponse(url: URL)

    public func activateUser(data: [String : Any], cb: @escaping (([String : Any]) -> Void?)) -> [String : Any]?

    public func loginUser(cb: @escaping (([String : Any]) -> Void?)) -> [String : Any]?


}

Upvotes: 0

Views: 741

Answers (1)

Duncan C
Duncan C

Reputation: 131491

As others have said, CocoaPods are intended for open source projects, and include all your source code. You want to build a framework or static library.

Do a Google search on "Xcode Create Framework". The top hit I found was this Ray Wenderlich article. Those are generally very good, although I don't know how current that one is. There are quite a few hits in the Google search results however.

Upvotes: 1

Related Questions