Skip to content

Commit 14d5e7f

Browse files
author
Marcel Tuchner
committed
Add support for SPM
1 parent 4948607 commit 14d5e7f

File tree

6 files changed

+90
-0
lines changed

6 files changed

+90
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
.DS_Store
33
*/build/*
44
build/*
5+
*/.build/*
6+
.build/*
57
*.pbxuser
68
!default.pbxuser
79
*.mode1v3

Package.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version:5.3
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "YouTubePlayer",
8+
platforms: [.iOS(.v13)],
9+
products: [
10+
.library(name: "YouTubePlayer",
11+
targets: ["YouTubePlayer"])
12+
],
13+
dependencies: [],
14+
targets: [
15+
.target(
16+
name: "YouTubePlayer",
17+
dependencies: [],
18+
path: "YouTubePlayer/YouTubePlayer",
19+
exclude: ["Info.plist"],
20+
resources: [
21+
.process("YTPlayer.html")
22+
]
23+
),
24+
.testTarget(
25+
name: "YouTubePlayerTests",
26+
dependencies: ["YouTubePlayer"],
27+
path: "YouTubePlayer/Tests/YouTubePlayerTests"
28+
)
29+
]
30+
)

YouTubePlayer.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// YouTubePlayerTests.swift
3+
// YouTubePlayer
4+
//
5+
// Created by Marcel on 04.03.21.
6+
// Copyright © 2021 Giles Van Gruisen. All rights reserved.
7+
//
8+
9+
import XCTest
10+
11+
class YouTubePlayerTests: XCTestCase {
12+
13+
override func setUpWithError() throws {
14+
// Put setup code here. This method is called before the invocation of each test method in the class.
15+
}
16+
17+
override func tearDownWithError() throws {
18+
// Put teardown code here. This method is called after the invocation of each test method in the class.
19+
}
20+
21+
func testExample() throws {
22+
// This is an example of a functional test case.
23+
// Use XCTAssert and related functions to verify your tests produce the correct results.
24+
}
25+
26+
func testPerformanceExample() throws {
27+
// This is an example of a performance test case.
28+
self.measure {
29+
// Put the code you want to measure the time of here.
30+
}
31+
}
32+
33+
}

YouTubePlayer/YouTubePlayer.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
/* Begin PBXBuildFile section */
1010
50E5B9C91A4CAA050099BF69 /* YTPlayer.html in Resources */ = {isa = PBXBuildFile; fileRef = 50E5B9C81A4CAA050099BF69 /* YTPlayer.html */; };
1111
50E5B9CB1A4CAA150099BF69 /* YouTubePlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E5B9CA1A4CAA150099BF69 /* YouTubePlayer.swift */; };
12+
E616AC7A25F0BBC200AAE4E2 /* YouTubePlayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E616AC7925F0BBC200AAE4E2 /* YouTubePlayerTests.swift */; };
1213
/* End PBXBuildFile section */
1314

1415
/* Begin PBXFileReference section */
1516
502AE85F1A475FD500306AD1 /* YouTubePlayer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = YouTubePlayer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1617
502AE8631A475FD500306AD1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = YouTubePlayer/Info.plist; sourceTree = "<group>"; };
1718
50E5B9C81A4CAA050099BF69 /* YTPlayer.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = YTPlayer.html; path = YouTubePlayer/YTPlayer.html; sourceTree = SOURCE_ROOT; };
1819
50E5B9CA1A4CAA150099BF69 /* YouTubePlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YouTubePlayer.swift; path = YouTubePlayer/YouTubePlayer.swift; sourceTree = SOURCE_ROOT; };
20+
E616AC7925F0BBC200AAE4E2 /* YouTubePlayerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YouTubePlayerTests.swift; sourceTree = "<group>"; };
1921
/* End PBXFileReference section */
2022

2123
/* Begin PBXFrameworksBuildPhase section */
@@ -32,6 +34,7 @@
3234
502AE8551A475FD500306AD1 = {
3335
isa = PBXGroup;
3436
children = (
37+
E616AC7725F0BB8800AAE4E2 /* Tests */,
3538
502AE8611A475FD500306AD1 /* YouTubePlayer */,
3639
502AE8601A475FD500306AD1 /* Products */,
3740
);
@@ -64,6 +67,22 @@
6467
name = "Supporting Files";
6568
sourceTree = "<group>";
6669
};
70+
E616AC7725F0BB8800AAE4E2 /* Tests */ = {
71+
isa = PBXGroup;
72+
children = (
73+
E616AC7825F0BB9600AAE4E2 /* YouTubePlayerTests */,
74+
);
75+
path = Tests;
76+
sourceTree = "<group>";
77+
};
78+
E616AC7825F0BB9600AAE4E2 /* YouTubePlayerTests */ = {
79+
isa = PBXGroup;
80+
children = (
81+
E616AC7925F0BBC200AAE4E2 /* YouTubePlayerTests.swift */,
82+
);
83+
path = YouTubePlayerTests;
84+
sourceTree = "<group>";
85+
};
6786
/* End PBXGroup section */
6887

6988
/* Begin PBXHeadersBuildPhase section */
@@ -145,6 +164,7 @@
145164
isa = PBXSourcesBuildPhase;
146165
buildActionMask = 2147483647;
147166
files = (
167+
E616AC7A25F0BBC200AAE4E2 /* YouTubePlayerTests.swift in Sources */,
148168
50E5B9CB1A4CAA150099BF69 /* YouTubePlayer.swift in Sources */,
149169
);
150170
runOnlyForDeploymentPostprocessing = 0;

YouTubePlayer/YouTubePlayer/YouTubePlayer.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright (c) 2014 Giles Van Gruisen. All rights reserved.
77
//
88

9+
#if canImport(UIKit)
910
import UIKit
1011
import WebKit
1112

@@ -376,3 +377,4 @@ private func printLog(_ strings: CustomStringConvertible...) {
376377
let toPrint = ["[YouTubePlayer]"] + strings
377378
print(toPrint, separator: " ", terminator: "\n")
378379
}
380+
#endif

0 commit comments

Comments
 (0)