Skip to content

Commit

Permalink
Merge pull request #2 from RougeWare/develop
Browse files Browse the repository at this point in the history
Sync `develop` into `master`
  • Loading branch information
KyNorthstar authored Oct 29, 2019
2 parents 6961e46 + 4e49086 commit 6ee8e3b
Show file tree
Hide file tree
Showing 10 changed files with 133 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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: "CrossKitTypes",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "CrossKitTypes",
targets: ["CrossKitTypes"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "CrossKitTypes",
dependencies: []),
.testTarget(
name: "CrossKitTypesTests",
dependencies: ["CrossKitTypes"]),
]
)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Swift-Cross-Kit-Types
# Cross-Kit Types #

Just some convenient `typealias`es and `extension`s to make it easier to use Apple types which are different in their different kits, like UIColor in UIKit and NSColor in AppKit.
27 changes: 27 additions & 0 deletions Sources/CrossKitTypes/Cross-Kit Color.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Cross-Kit Color.swift
// Cross-Kit Types
//
// Created by Ben Leggiero on 2019-10-28.
// Copyright © 2019 BH-1-PS
//



#if !ONLY_APP_KIT && canImport(UIKit)
import UIKit



typealias NativeColor = UIColor

#elseif canImport(AppKit)
import AppKit



typealias NativeColor = NSColor

#else
#error("Unsupported platform; neither UIKit nor AppKit")
#endif
27 changes: 27 additions & 0 deletions Sources/CrossKitTypes/Cross-Kit Font.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Cross-Kit Font.swift
// Cross-Kit Types
//
// Created by Ben Leggiero on 2019-10-28.
// Copyright © 2019 BH-1-PS
//



#if !ONLY_APP_KIT && canImport(UIKit)
import UIKit



typealias NativeFont = UIFont

#elseif canImport(AppKit)
import AppKit



typealias NativeFont = NSFont

#else
#error("Unsupported platform; neither UIKit nor AppKit")
#endif
12 changes: 12 additions & 0 deletions Tests/CrossKitTypesTests/CrossKitTypesTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest
@testable import CrossKitTypes

final class CrossKitTypesTests: XCTestCase {
func testNothing() {
// TODO: Add tests
}

static var allTests = [
("testNothing", testNothing),
]
}
9 changes: 9 additions & 0 deletions Tests/CrossKitTypesTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(CrossKitTypesTests.allTests),
]
}
#endif
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import CrossKitTypesTests

var tests = [XCTestCaseEntry]()
tests += CrossKitTypesTests.allTests()
XCTMain(tests)

0 comments on commit 6ee8e3b

Please sign in to comment.