diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95c4320 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..706eede --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..bd7f299 --- /dev/null +++ b/Package.swift @@ -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"]), + ] +) diff --git a/README.md b/README.md index 0471fee..3d9a135 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/Sources/CrossKitTypes/Cross-Kit Color.swift b/Sources/CrossKitTypes/Cross-Kit Color.swift new file mode 100644 index 0000000..f25ecc3 --- /dev/null +++ b/Sources/CrossKitTypes/Cross-Kit Color.swift @@ -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 diff --git a/Sources/CrossKitTypes/Cross-Kit Font.swift b/Sources/CrossKitTypes/Cross-Kit Font.swift new file mode 100644 index 0000000..1912600 --- /dev/null +++ b/Sources/CrossKitTypes/Cross-Kit Font.swift @@ -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 diff --git a/Tests/CrossKitTypesTests/CrossKitTypesTests.swift b/Tests/CrossKitTypesTests/CrossKitTypesTests.swift new file mode 100644 index 0000000..66f3aff --- /dev/null +++ b/Tests/CrossKitTypesTests/CrossKitTypesTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import CrossKitTypes + +final class CrossKitTypesTests: XCTestCase { + func testNothing() { + // TODO: Add tests + } + + static var allTests = [ + ("testNothing", testNothing), + ] +} diff --git a/Tests/CrossKitTypesTests/XCTestManifests.swift b/Tests/CrossKitTypesTests/XCTestManifests.swift new file mode 100644 index 0000000..1196e61 --- /dev/null +++ b/Tests/CrossKitTypesTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(CrossKitTypesTests.allTests), + ] +} +#endif diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..999ace0 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import CrossKitTypesTests + +var tests = [XCTestCaseEntry]() +tests += CrossKitTypesTests.allTests() +XCTMain(tests)