How to use ObjC in Swift Package Manager

Issue #575 Create Objc target http://ankit.im/swift/2016/05/21/creating-objc-cpp-packages-with-swift-package-manager/ Check runtime Check for example _runtime(_ObjC) or os(macOS if you plan to use platform specific feature https://github.com/Quick/Quick/blob/master/Package.swift https://github.com/Quick/Quick/pull/687/files For example, in test we use XCTest which is run via Xcode and is a macOS framework, so we need to check for os(macOS) Note that in Objc framework, the header files must be in include folder targets: { var targets: [Target] = [ ....

January 11, 2020 · 1 min · Khoa Pham

How to fix library not found with SPM and CocoaPods in Xcode

Issue #572 After migrating a few pods to use SPM, some libraries fail to load. This is because the workspace now uses both SPM and cocoapods code signature in … not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?) The workaround is to disable Library validation

January 8, 2020 · 1 min · Khoa Pham

How to test a developing package with Swift Package Manager

Issue #525 Use macOS Command Line project Example Puma Create a new macOS project, select Command Line Tool Drag Puma.xcodeproj as a sub project of our test project Go to our TestPuma target, under Link Binary with Libraries, select Puma framework Puma has dependencies on PumaCore and PumaiOS, but in Xcode we only need to select Puma framework In code, we need to explicitly import PumaiOS framework if we use any of its classes...

November 30, 2019 · 2 min · Khoa Pham

How to organize dependencies in Swift Package Manager

Issue #523 In Puma I want to make build tools for iOS and Android, which should share some common infrastructure. So we can organize dependencies like. Puma -> PumaAndroid, PumaiOS -> PumaCore -> xcbeautify, Files, Colorizer // swift-tools-version:5.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "Puma", platforms: [.macOS("10.15")], products: [ .library(name: "Puma", targets: ["Puma"]) ], dependencies: [ ....

November 30, 2019 · 1 min · Khoa Pham

How to make Swift Package Manager package for multiple platforms

Issue #504 https://twitter.com/NeoNacho/status/1181245484867801088?s=20 There’s no way to have platform specific sources or targets today, so you’ll have to take a different approach. I would recommend wrapping all OS specific files in #if os and just having one target. For tests, you could do something similar, one test target, but conditional tests Every files are in Sources folder, so we can use platform and version checks. For example Omnia is a Swift Package Manager that supports iOS, tvOS, watchOS, macOS and Catalyst....

November 13, 2019 · 1 min · Khoa Pham