1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-11-11 01:42:35 +03:00

Merge pull request #254 from hirschfl/swift_package_manger

Add support for Swift Package Manager
This commit is contained in:
Yuri Strot 2017-12-18 16:45:57 +07:00 committed by GitHub
commit 600d99e765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 0 deletions

23
Package.swift Normal file
View File

@ -0,0 +1,23 @@
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "Macaw",
products: [
.library(
name: "Macaw",
targets: ["Macaw"]),
],
dependencies: [],
targets: [
.target(
name: "SWXMLHash",
dependencies: [],
path: "Dependencies/SWXMLHash"),
.target(
name: "Macaw",
dependencies: ["SWXMLHash"],
path: "Source")
]
)

View File

@ -89,6 +89,16 @@ pod "Macaw", "0.9.1"
github "Exyte/Macaw" ~> 0.9.1
```
## [Swift Package Manager] (https://swift.org/package-manager/)
To install it, simply add the following line to to the `dependencies` value of your `Package.swift`:
```swift
dependencies: [
.package(url: "https://github.com/exyte/Macaw.git", from: "0.9.2")
]
```
## Building from sources
To build Macaw from sources:

View File

@ -71,6 +71,11 @@ class TextRenderer: NodeRenderer {
}
fileprivate func getMFont() -> MFont {
guard #available(iOS 9.0, macOS 10.11, *) else {
// This case should never happen, since the deployment target is set to iOS 9.0/macOS 10.11.
// However it is needed for the Swift Package Manager to work accordingly.
return MFont()
}
guard let text = text else {
return MFont.systemFont(ofSize: 18.0)
}
@ -89,6 +94,11 @@ class TextRenderer: NodeRenderer {
}
fileprivate func getWeight(_ weight: String) -> MFont.Weight? {
guard #available(iOS 9.0, macOS 10.11, *) else {
// This case should never happen, since the deployment target is set to iOS 9.0/macOS 10.11.
// However it is needed for the Swift Package Manager to work accordingly.
return .none
}
switch weight {
case "normal":
return MFont.Weight.regular