最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

option type - iOS making optional framework with canimport - Stack Overflow

programmeradmin4浏览0评论

I’m trying to create a CustomFramework that uses PLCrashReporter and CocoaLumberjack.

If the consuming application does not embed either one of these SDKs, the framework should skip executing the code that relies on the missing SDK.

Here’s the code I’m using inside custom framework

public static func testSDKS() {
    #if canImport(PLCrashReporter)
    print("PLCrashReporter is available")
    #endif

    #if canImport(CocoaLumberjack)
    print("CocoaLumberjack is available")
    #endif
}

and inside sample app i am using this

SDK.testSDKS()

here is full repo of code I want to fix by adding this external frameworks via SPM approach only, but open to suggestion why it won't work with SPM approach.

发布评论

评论列表(0)

  1. 暂无评论