From a888051b5fe8c75ec980f06ba1e76085a92384de Mon Sep 17 00:00:00 2001 From: ankierman Date: Sat, 19 Oct 2019 00:31:06 +0200 Subject: [PATCH 1/4] Support SPM ModernAVPlayer --- Package.swift | 17 +++++++++++++++++ README.md | 4 ++++ .../Core/Components/ModernAVPlayerMedia.swift | 2 ++ .../ModernAVPlayerMediaMetadata.swift | 2 ++ Sources/Core/Components/PlayerContext.swift | 1 + Sources/Core/State/LoadingMediaState.swift | 1 + 6 files changed, 27 insertions(+) create mode 100644 Package.swift diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..d5fea6a2 --- /dev/null +++ b/Package.swift @@ -0,0 +1,17 @@ +// swift-tools-version:5.0 +import PackageDescription + +let package = Package( + name: "ModernAVPlayer", + platforms: [SupportedPlatform.iOS("10.0")], + products: [ + .library(name: "ModernAVPlayer", targets: ["ModernAVPlayer"]), + ], + targets: [ + .target( + name: "ModernAVPlayer", + path: "Sources/Core" + ) + ] +) + diff --git a/README.md b/README.md index 9533ca77..a2be3343 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ ## Installation +### Swift Package Manager + +Supported version: ``swift-tools-version:5.0`` + ### CocoaPods [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: diff --git a/Sources/Core/Components/ModernAVPlayerMedia.swift b/Sources/Core/Components/ModernAVPlayerMedia.swift index fcb488c1..76a4bcfc 100644 --- a/Sources/Core/Components/ModernAVPlayerMedia.swift +++ b/Sources/Core/Components/ModernAVPlayerMedia.swift @@ -24,6 +24,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +import Foundation + public class ModernAVPlayerMedia: PlayerMedia { // MARK: - Outputs diff --git a/Sources/Core/Components/ModernAVPlayerMediaMetadata.swift b/Sources/Core/Components/ModernAVPlayerMediaMetadata.swift index 2e7f66a8..244f151a 100644 --- a/Sources/Core/Components/ModernAVPlayerMediaMetadata.swift +++ b/Sources/Core/Components/ModernAVPlayerMediaMetadata.swift @@ -24,6 +24,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +import Foundation + public struct ModernAVPlayerMediaMetadata: PlayerMediaMetadata, Equatable { public let title: String? public let albumTitle: String? diff --git a/Sources/Core/Components/PlayerContext.swift b/Sources/Core/Components/PlayerContext.swift index 6fdf5c4c..127e6b60 100644 --- a/Sources/Core/Components/PlayerContext.swift +++ b/Sources/Core/Components/PlayerContext.swift @@ -25,6 +25,7 @@ // THE SOFTWARE. import AVFoundation +import UIKit //sourcery: AutoMockable protocol PlayerContextDelegate: class { diff --git a/Sources/Core/State/LoadingMediaState.swift b/Sources/Core/State/LoadingMediaState.swift index ee2ec84d..1e664d4f 100644 --- a/Sources/Core/State/LoadingMediaState.swift +++ b/Sources/Core/State/LoadingMediaState.swift @@ -25,6 +25,7 @@ // THE SOFTWARE. import AVFoundation +import UIKit final class LoadingMediaState: PlayerState { From 43cd3be494e99e7ca80f37bb502753ef3a7d501e Mon Sep 17 00:00:00 2001 From: ankierman Date: Wed, 30 Oct 2019 12:09:07 +0100 Subject: [PATCH 2/4] Support SPM RxModernAVPlayer --- Package.swift | 11 ++++++++++- .../RxModernAVPlayer/ConcretePlayerContext+Rx.swift | 2 ++ .../RxModernAVPlayer/PlayerContextDelegateProxy.swift | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index d5fea6a2..219b606e 100644 --- a/Package.swift +++ b/Package.swift @@ -6,11 +6,20 @@ let package = Package( platforms: [SupportedPlatform.iOS("10.0")], products: [ .library(name: "ModernAVPlayer", targets: ["ModernAVPlayer"]), + .library(name: "RxModernAVPlayer", targets: ["RxModernAVPlayer"]) ], + dependencies: [ + .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "5.0.0")) + ], targets: [ .target( - name: "ModernAVPlayer", + name: "ModernAVPlayer", path: "Sources/Core" + ), + .target( + name: "RxModernAVPlayer", + dependencies: ["ModernAVPlayer", "RxSwift", "RxCocoa"], + path: "Sources/RxModernAVPlayer" ) ] ) diff --git a/Sources/RxModernAVPlayer/ConcretePlayerContext+Rx.swift b/Sources/RxModernAVPlayer/ConcretePlayerContext+Rx.swift index b46ec646..04d105ad 100644 --- a/Sources/RxModernAVPlayer/ConcretePlayerContext+Rx.swift +++ b/Sources/RxModernAVPlayer/ConcretePlayerContext+Rx.swift @@ -24,6 +24,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// Compilation failed from SPM without this import +import ModernAVPlayer import RxCocoa import RxSwift diff --git a/Sources/RxModernAVPlayer/PlayerContextDelegateProxy.swift b/Sources/RxModernAVPlayer/PlayerContextDelegateProxy.swift index 1ef5bcad..a4f6b8bc 100644 --- a/Sources/RxModernAVPlayer/PlayerContextDelegateProxy.swift +++ b/Sources/RxModernAVPlayer/PlayerContextDelegateProxy.swift @@ -24,6 +24,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// Compilation failed from SPM without this import +import ModernAVPlayer import RxCocoa import RxSwift From 44804eea450faa1632b237efd7a697d7f88863c9 Mon Sep 17 00:00:00 2001 From: ankierman Date: Wed, 6 Nov 2019 02:01:19 +0100 Subject: [PATCH 3/4] Update readme --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index a2be3343..52392f0e 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,22 @@ Supported version: ``swift-tools-version:5.0`` +```swift +// Package.swift + +import PackageDescription + +let package = Package( + name: "Sample", + dependencies: [ + .package(url: "https://github.com/noreasonprojects/ModernAVPlayer", from: "X.X.X") + ], + targets: [ + .target(name: "Sample", dependencies: ["ModernAVPlayer"]) + ] +) +``` + ### CocoaPods [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: From 5b25355e7d82349e746563f2c2ed2c588e50dafd Mon Sep 17 00:00:00 2001 From: ankierman Date: Wed, 6 Nov 2019 02:17:09 +0100 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f8ab1ab..daf1ca06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. --- ## [X.X.X] +* Feature: + * Support SPM * Fix: * Seek available on stream media * Break changes: