Skip to content

Commit

Permalink
Changes to support importing ObjC package via XCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonystone committed Apr 7, 2022
1 parent db633b7 commit eb8948d
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,15 @@ let package = Package(
name: "TraceLog",
targets: [
/// Module targets
.target(name: "TraceLog", dependencies: [], path: "Sources/TraceLog"),
.target(name: "TraceLog", dependencies: [], path: "Sources/TraceLog"),
.target(name: "TraceLogObjC", dependencies: ["TraceLog"], path: "Sources/TraceLogObjC"),

/// Tests
.testTarget(name: "TraceLogTests", dependencies: ["TraceLog"], path: "Tests/TraceLogTests")
.testTarget(name: "TraceLogTests", dependencies: ["TraceLog"], path: "Tests/TraceLogTests"),
.testTarget(name: "TraceLogObjCTests", dependencies: ["TraceLogObjC"], path: "Tests/TraceLogObjCTests")
],
swiftLanguageVersions: [.version("5")]
)

var productTargets = ["TraceLog"]

///
/// These platforms can also support Objective-C so we create a module for it.
///
#if canImport(ObjectiveC)
package.targets.append( .target(name: "TraceLogObjC", dependencies: ["TraceLog"], path: "Sources/TraceLogObjC"))
package.targets.append(.testTarget(name: "TraceLogObjCTests", dependencies: ["TraceLogObjC"], path: "Tests/TraceLogObjCTests"))

productTargets.append("TraceLogObjC")
#endif

/// Main products section
package.products.append(.library(name: "TraceLog", type: .dynamic, targets: productTargets))
package.products.append(.library(name: "TraceLog", type: .dynamic, targets: ["TraceLog", "TraceLogObjC"]))

0 comments on commit eb8948d

Please sign in to comment.