How to create a custom Swift environment and how is it related to SPM?

I am currently creating code that I really would like to use as a framework, being able to import MyCustomFramework, as is the case with Apple wireframes (in the future I would also like to distribute them).

I have some questions about this:

  • What is the easiest way to create a framework like what I want? Is it possible to do this directly in Xcode or do I need to use command line tools in the terminal?
  • Whether this structure will be compatible with several platforms (I think of all Apple platforms, as well as other platforms supported by Swift, such as Linux).
  • What is the relationship between the Swift and Swift Package Manager structures? Do I need SPM to create my framework or are these two different tools?

Thank.

+4
source share
2 answers

Swift Package Manager (SPM) and Xcode Frameworks currently follow different paths. For Linux, you need to follow the SPM path, since the only way to compile an application for working quickly with Linux is to use SPM. For macOS command line applications, you can also follow the SPM path. For iOS and MacOS UI applications, you must follow the Xcode Frameworks path.

SPM SPM: Package.swift SPM. git. git / SPM. SPM Xcode swift package generate-xcodeproj.

Xcode Frameworks - , SPM Xcode, . Xcode, .

, , SPM Linux MacOS, Xcode iOS MacOS UI, . SPM Xcode, . - Package.swift Xcode.

+3
  • , Xcode Framework 2 . Frameworks, , . ( , / , , , .)

  • Swift Framework Apple, , UIKit, Foundation . ( , , .

  • Swift: Swift () . Swift 3 Linux, , ( Swift 4), Apple.

  • Swift Swift 2 3. , , , .

+3

Source: https://habr.com/ru/post/1664999/


All Articles