diff --git a/.gitignore b/.gitignore index d58796dc..b407f44f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ Docs/Private Docs/Sketch Demo/shaders/* *.graffle +.build +.swiftpm +.DS_Store diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..3718e15d --- /dev/null +++ b/Package.swift @@ -0,0 +1,51 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SKTiled", + platforms: [ + .iOS(.v12), + .macOS(.v10_12), + .tvOS(.v12) + ], + products: [ + .library( + name: "SKTiled", + targets: ["SKTiled"]), + ], + dependencies: [], + targets: [ + .target( + name: "SKTiled", + dependencies: [], + path: "Sources", + exclude: ["Info.plist"] + ), + .testTarget( + name: "SKTiledTests", + dependencies: ["SKTiled"], + path: "Tests", + exclude: [ + "Info-tvOS.plist", + "Info-iOS.plist", + "Info-macOS.plist" + ], + resources: [ + .copy("Assets/test-tilemap.tmx"), + .copy("Assets/characters-8x8.png"), + .copy("Assets/characters-8x8.tsx"), + .copy("Assets/environment-8x8.png"), + .copy("Assets/environment-8x8.tsx"), + .copy("Assets/items-8x8.png"), + .copy("Assets/items-8x8.tsx"), + .copy("Assets/items-alt-8x8.png"), + .copy("Assets/monsters-16x16.png"), + .copy("Assets/monsters-16x16.tsx"), + .copy("Assets/portraits-8x8.png"), + .copy("Assets/portraits-8x8.tsx") + ] + ) + ] +) diff --git a/Tests/CoordinateTests.swift b/Tests/CoordinateTests.swift index 6cfb69de..1576426e 100644 --- a/Tests/CoordinateTests.swift +++ b/Tests/CoordinateTests.swift @@ -46,11 +46,11 @@ class CoordinateTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) { - let mapurl = testBundle!.url(forResource: tilemapName, withExtension: "tmx")! + let mapurl = testBundle.url(forResource: tilemapName, withExtension: "tmx")! tilemap = SKTilemap.load(tmxFile: mapurl.path, loggingLevel: .none) } } diff --git a/Tests/ParserTests.swift b/Tests/ParserTests.swift index d441706d..08f7121e 100644 --- a/Tests/ParserTests.swift +++ b/Tests/ParserTests.swift @@ -43,7 +43,7 @@ class ParserTests: XCTestCase { super.setUp() if (testBundle == nil) { - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) { diff --git a/Tests/PerformanceTests.swift b/Tests/PerformanceTests.swift index aba92c2c..004677e7 100644 --- a/Tests/PerformanceTests.swift +++ b/Tests/PerformanceTests.swift @@ -39,7 +39,7 @@ class PerformanceTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } } diff --git a/Tests/PropertiesTests.swift b/Tests/PropertiesTests.swift index a1091c43..0beaab2a 100644 --- a/Tests/PropertiesTests.swift +++ b/Tests/PropertiesTests.swift @@ -39,7 +39,7 @@ class PropertiesTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) { diff --git a/Tests/QueryTests.swift b/Tests/QueryTests.swift index a28004f1..10633a0c 100644 --- a/Tests/QueryTests.swift +++ b/Tests/QueryTests.swift @@ -42,7 +42,7 @@ class QueryTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) { diff --git a/Tests/TilemapTests.swift b/Tests/TilemapTests.swift index 68792128..2800e255 100644 --- a/Tests/TilemapTests.swift +++ b/Tests/TilemapTests.swift @@ -40,7 +40,7 @@ class TilemapTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) { diff --git a/Tests/TilesetTests.swift b/Tests/TilesetTests.swift index 2f67457f..a2309e2a 100644 --- a/Tests/TilesetTests.swift +++ b/Tests/TilesetTests.swift @@ -43,7 +43,7 @@ class TilesetTests: XCTestCase { if (testBundle == nil) { TiledGlobals.default.loggingLevel = .none - testBundle = Bundle(for: type(of: self)) + testBundle = Bundle.module } if (tilemap == nil) {