Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on Linux with SwiftPM #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ jobs:

spm:
name: SwiftPM
runs-on: macos-latest
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
Expand Down
6 changes: 5 additions & 1 deletion Sources/Tentacle/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import Foundation

#if os(iOS) || os(tvOS)
#if !os(Linux)

#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit
public typealias Color = UIColor
#else
Expand All @@ -30,3 +32,5 @@ extension Color {
self.init(red: r, green: g, blue: b, alpha: 1)
}
}

#endif
18 changes: 15 additions & 3 deletions Sources/Tentacle/Label.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ import Foundation

public struct Label: CustomStringConvertible, ResourceType {
public let name: String
public let color: Color

public var description: String {
return name
#if os(Linux)
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.name = try container.decode(String.self, forKey: .name)
}

public init(name: String) {
self.name = name
}
#else
public let color: Color

public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
Expand All @@ -26,6 +33,11 @@ public struct Label: CustomStringConvertible, ResourceType {
self.name = name
self.color = color
}
#endif

public var description: String {
return name
}

private enum CodingKeys: String, CodingKey {
case name
Expand Down