diff --git a/Example/SwiftAudio.xcodeproj/project.pbxproj b/Example/SwiftAudio.xcodeproj/project.pbxproj index 5cdf3e7..66eefe8 100644 --- a/Example/SwiftAudio.xcodeproj/project.pbxproj +++ b/Example/SwiftAudio.xcodeproj/project.pbxproj @@ -16,8 +16,42 @@ 9B8819782BC866E800E20DCE /* SwiftAudioEx in Frameworks */ = {isa = PBXBuildFile; productRef = 9B8819772BC866E800E20DCE /* SwiftAudioEx */; }; 9B88197A2BC9883200E20DCE /* PlayerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8819792BC9883200E20DCE /* PlayerViewModel.swift */; }; 9B88197C2BC98F5000E20DCE /* QueueView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B88197B2BC98F5000E20DCE /* QueueView.swift */; }; + F0A05BE72C66962E00898E8B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F0A05BE62C66962E00898E8B /* Preview Assets.xcassets */; }; + F0A05BEA2C66962E00898E8B /* SwiftAudioWatch Watch App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = F0A05BDD2C66962C00898E8B /* SwiftAudioWatch Watch App.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + F0A05BEE2C66970700898E8B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9B8819602BC8657B00E20DCE /* Assets.xcassets */; }; + F0A05BEF2C66974E00898E8B /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B88196F2BC866A300E20DCE /* Extensions.swift */; }; + F0A05BF02C66974E00898E8B /* AudioController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B88196C2BC866A300E20DCE /* AudioController.swift */; }; + F0A05BF12C66974E00898E8B /* PlayerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8819792BC9883200E20DCE /* PlayerViewModel.swift */; }; + F0A05BF22C66974E00898E8B /* SwiftAudioApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B88195C2BC8657A00E20DCE /* SwiftAudioApp.swift */; }; + F0A05BF32C66974E00898E8B /* QueueView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B88197B2BC98F5000E20DCE /* QueueView.swift */; }; + F0A05BF62C6697A200898E8B /* SwiftAudioEx in Frameworks */ = {isa = PBXBuildFile; productRef = F0A05BF52C6697A200898E8B /* SwiftAudioEx */; }; + F0A05BF82C669B7B00898E8B /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A05BF72C669B7B00898E8B /* PlayerView.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + F0A05BE82C66962E00898E8B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9B8819512BC8657A00E20DCE /* Project object */; + proxyType = 1; + remoteGlobalIDString = F0A05BDC2C66962C00898E8B; + remoteInfo = "SwiftAudioWatch Watch App"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + F0A05BCF2C6695F300898E8B /* Embed Watch Content */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/Watch"; + dstSubfolderSpec = 16; + files = ( + F0A05BEA2C66962E00898E8B /* SwiftAudioWatch Watch App.app in Embed Watch Content */, + ); + name = "Embed Watch Content"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 9B8819592BC8657A00E20DCE /* SwiftAudio.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftAudio.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9B88195C2BC8657A00E20DCE /* SwiftAudioApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftAudioApp.swift; sourceTree = ""; }; @@ -30,6 +64,9 @@ 9B8819702BC866A300E20DCE /* PlayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; 9B8819792BC9883200E20DCE /* PlayerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewModel.swift; sourceTree = ""; }; 9B88197B2BC98F5000E20DCE /* QueueView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueView.swift; sourceTree = ""; }; + F0A05BDD2C66962C00898E8B /* SwiftAudioWatch Watch App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftAudioWatch Watch App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + F0A05BE62C66962E00898E8B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + F0A05BF72C669B7B00898E8B /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -41,6 +78,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0A05BDA2C66962C00898E8B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F0A05BF62C6697A200898E8B /* SwiftAudioEx in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -49,6 +94,7 @@ children = ( 9B88196B2BC865E100E20DCE /* SwiftAudioEx */, 9B88195B2BC8657A00E20DCE /* SwiftAudio */, + F0A05BDE2C66962C00898E8B /* SwiftAudioWatch Watch App */, 9B88195A2BC8657A00E20DCE /* Products */, 9B8819762BC866E800E20DCE /* Frameworks */, ); @@ -58,6 +104,7 @@ isa = PBXGroup; children = ( 9B8819592BC8657A00E20DCE /* SwiftAudio.app */, + F0A05BDD2C66962C00898E8B /* SwiftAudioWatch Watch App.app */, ); name = Products; sourceTree = ""; @@ -93,6 +140,23 @@ name = Frameworks; sourceTree = ""; }; + F0A05BDE2C66962C00898E8B /* SwiftAudioWatch Watch App */ = { + isa = PBXGroup; + children = ( + F0A05BF72C669B7B00898E8B /* PlayerView.swift */, + F0A05BE52C66962E00898E8B /* Preview Content */, + ); + path = "SwiftAudioWatch Watch App"; + sourceTree = ""; + }; + F0A05BE52C66962E00898E8B /* Preview Content */ = { + isa = PBXGroup; + children = ( + F0A05BE62C66962E00898E8B /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -103,10 +167,12 @@ 9B8819552BC8657A00E20DCE /* Sources */, 9B8819562BC8657A00E20DCE /* Frameworks */, 9B8819572BC8657A00E20DCE /* Resources */, + F0A05BCF2C6695F300898E8B /* Embed Watch Content */, ); buildRules = ( ); dependencies = ( + F0A05BE92C66962E00898E8B /* PBXTargetDependency */, ); name = SwiftAudio; packageProductDependencies = ( @@ -116,6 +182,26 @@ productReference = 9B8819592BC8657A00E20DCE /* SwiftAudio.app */; productType = "com.apple.product-type.application"; }; + F0A05BDC2C66962C00898E8B /* SwiftAudioWatch Watch App */ = { + isa = PBXNativeTarget; + buildConfigurationList = F0A05BEB2C66962E00898E8B /* Build configuration list for PBXNativeTarget "SwiftAudioWatch Watch App" */; + buildPhases = ( + F0A05BD92C66962C00898E8B /* Sources */, + F0A05BDA2C66962C00898E8B /* Frameworks */, + F0A05BDB2C66962C00898E8B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SwiftAudioWatch Watch App"; + packageProductDependencies = ( + F0A05BF52C6697A200898E8B /* SwiftAudioEx */, + ); + productName = "SwiftAudioWatch Watch App"; + productReference = F0A05BDD2C66962C00898E8B /* SwiftAudioWatch Watch App.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -123,12 +209,15 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1530; + LastSwiftUpdateCheck = 1540; LastUpgradeCheck = 1530; TargetAttributes = { 9B8819582BC8657A00E20DCE = { CreatedOnToolsVersion = 15.3; }; + F0A05BDC2C66962C00898E8B = { + CreatedOnToolsVersion = 15.4; + }; }; }; buildConfigurationList = 9B8819542BC8657A00E20DCE /* Build configuration list for PBXProject "SwiftAudio" */; @@ -145,6 +234,7 @@ projectRoot = ""; targets = ( 9B8819582BC8657A00E20DCE /* SwiftAudio */, + F0A05BDC2C66962C00898E8B /* SwiftAudioWatch Watch App */, ); }; /* End PBXProject section */ @@ -159,6 +249,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0A05BDB2C66962C00898E8B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F0A05BE72C66962E00898E8B /* Preview Assets.xcassets in Resources */, + F0A05BEE2C66970700898E8B /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -175,8 +274,29 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F0A05BD92C66962C00898E8B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F0A05BEF2C66974E00898E8B /* Extensions.swift in Sources */, + F0A05BF02C66974E00898E8B /* AudioController.swift in Sources */, + F0A05BF82C669B7B00898E8B /* PlayerView.swift in Sources */, + F0A05BF12C66974E00898E8B /* PlayerViewModel.swift in Sources */, + F0A05BF22C66974E00898E8B /* SwiftAudioApp.swift in Sources */, + F0A05BF32C66974E00898E8B /* QueueView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + F0A05BE92C66962E00898E8B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F0A05BDC2C66962C00898E8B /* SwiftAudioWatch Watch App */; + targetProxy = F0A05BE82C66962E00898E8B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ 9B8819662BC8657B00E20DCE /* Debug */ = { isa = XCBuildConfiguration; @@ -295,6 +415,7 @@ 9B8819692BC8657B00E20DCE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = SwiftAudio/SwiftAudio.entitlements; @@ -333,6 +454,7 @@ 9B88196A2BC8657B00E20DCE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = SwiftAudio/SwiftAudio.entitlements; @@ -368,6 +490,69 @@ }; name = Release; }; + F0A05BEC2C66962E00898E8B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"SwiftAudioWatch Watch App/Preview Content\""; + DEVELOPMENT_TEAM = 7U2TUNKNQX; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = SwiftAudioWatch; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = com.doublesymmetry.SwiftAudio; + INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.doublesymmetry.SwiftAudio.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + WATCHOS_DEPLOYMENT_TARGET = 10.5; + }; + name = Debug; + }; + F0A05BED2C66962E00898E8B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"SwiftAudioWatch Watch App/Preview Content\""; + DEVELOPMENT_TEAM = 7U2TUNKNQX; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_CFBundleDisplayName = SwiftAudioWatch; + INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; + INFOPLIST_KEY_WKCompanionAppBundleIdentifier = com.doublesymmetry.SwiftAudio; + INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp = YES; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.doublesymmetry.SwiftAudio.watchkitapp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = watchos; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 4; + VALIDATE_PRODUCT = YES; + WATCHOS_DEPLOYMENT_TARGET = 10.5; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -389,6 +574,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F0A05BEB2C66962E00898E8B /* Build configuration list for PBXNativeTarget "SwiftAudioWatch Watch App" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F0A05BEC2C66962E00898E8B /* Debug */, + F0A05BED2C66962E00898E8B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCSwiftPackageProductDependency section */ @@ -396,6 +590,10 @@ isa = XCSwiftPackageProductDependency; productName = SwiftAudioEx; }; + F0A05BF52C6697A200898E8B /* SwiftAudioEx */ = { + isa = XCSwiftPackageProductDependency; + productName = SwiftAudioEx; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 9B8819512BC8657A00E20DCE /* Project object */; diff --git a/Example/SwiftAudio/PlayerViewModel.swift b/Example/SwiftAudio/PlayerViewModel.swift index c2f8740..efccaa0 100644 --- a/Example/SwiftAudio/PlayerViewModel.swift +++ b/Example/SwiftAudio/PlayerViewModel.swift @@ -10,7 +10,7 @@ import SwiftAudioEx #if os(macOS) import AppKit public typealias NativeImage = NSImage -#elseif os(iOS) +#elseif canImport(UIKit) import UIKit public typealias NativeImage = UIImage #endif diff --git a/Example/SwiftAudioWatch Watch App/PlayerView.swift b/Example/SwiftAudioWatch Watch App/PlayerView.swift new file mode 100644 index 0000000..4476526 --- /dev/null +++ b/Example/SwiftAudioWatch Watch App/PlayerView.swift @@ -0,0 +1,171 @@ +// +// PlayerView.swift +// SwiftAudioWatch Watch App +// +// Created by Konstantin Späth on 09.08.24. +// + +import SwiftUI +import SwiftAudioEx + +struct PlayerView: View { + @ObservedObject var viewModel: ViewModel + @State private var showingQueue = false + + let controller = AudioController.shared + + init(viewModel: PlayerView.ViewModel = ViewModel()) { + self.viewModel = viewModel + } + + var body: some View { + ScrollView { + VStack(spacing: 0) { + HStack(alignment: .center) { + Spacer() + Button(action: { showingQueue.toggle() }, label: { + Text("Queue") + .fontWeight(.bold) + }) + } + + if let image = viewModel.artwork { + #if os(macOS) + Image(nsImage: image) + .resizable() + .scaledToFit() + .frame(width: 240, height: 240) + .padding(.top, 30) + #elseif canImport(UIKit) + Image(uiImage: image) + .resizable() + .scaledToFit() + .frame(width: 100, height: 100) + .padding(.top, 30) + #endif + } else { + AsyncImage(url: nil) + .frame(width: 240, height: 240) + .padding(.top, 30) + } + + VStack(spacing: 4) { + Text(viewModel.title) + .fontWeight(.semibold) + .font(.system(size: 18)) + Text(viewModel.artist) + .fontWeight(.thin) + } + .padding(.top, 30) + + if viewModel.maxTime > 0 { + VStack { + Slider(value: $viewModel.position, in: 0...viewModel.maxTime) { editing in + viewModel.isScrubbing = editing + print("scrubbing = \(viewModel.isScrubbing)") + if viewModel.isScrubbing == false { + controller.player.seek(to: viewModel.position) + } + } + HStack { + Text(viewModel.elapsedTime) + .font(.system(size: 14)) + Spacer() + Text(viewModel.remainingTime) + .font(.system(size: 14)) + } + } + .padding(.top, 25) + } else { + Text("Live Stream") + .padding(.top, 35) + } + + HStack { + Button(action: controller.player.previous, label: { + Text("Prev") + .font(.system(size: 14)) + }) + .frame(maxWidth: .infinity) + + Button(action: { + if viewModel.playing { + controller.player.pause() + } else { + controller.player.play() + } + }, label: { + Text(!viewModel.playWhenReady || viewModel.playbackState == .failed ? "Play" : "Pause") + .font(.system(size: 18)) + .fontWeight(.semibold) + }) + + .frame(maxWidth: .infinity) + Button(action: controller.player.next, label: { + Text("Next") + .font(.system(size: 14)) + }) + .frame(maxWidth: .infinity) + } + .padding(.top, 80) + + VStack { + if viewModel.playbackState == .failed { + Text("Playback failed.") + .font(.system(size: 14)) + .foregroundStyle(.red) + .padding(.top, 20) + } else if (viewModel.playbackState == .loading || viewModel.playbackState == .buffering) && viewModel.playWhenReady { + ProgressView() + .progressViewStyle(.circular) + .controlSize(.small) + .padding(.top, 20) + } + } + + Spacer() + } + .sheet(isPresented: $showingQueue) { + QueueView() + } + .padding(.horizontal, 16) + .padding(.top) + } + } +} + +#Preview("Standard") { + let viewModel = PlayerView.ViewModel() + viewModel.title = "Longing" + viewModel.artist = "David Chavez" + + return PlayerView(viewModel: viewModel) +} + +#Preview("Error") { + let viewModel = PlayerView.ViewModel() + viewModel.title = "Longing" + viewModel.artist = "David Chavez" + viewModel.playbackState = .failed + + return PlayerView(viewModel: viewModel) +} + +#Preview("Buffering") { + let viewModel = PlayerView.ViewModel() + viewModel.title = "Longing" + viewModel.artist = "David Chavez" + viewModel.playbackState = .buffering + viewModel.playWhenReady = true + + return PlayerView(viewModel: viewModel) +} + +#Preview("Live Stream") { + let viewModel = PlayerView.ViewModel() + viewModel.title = "Longing" + viewModel.artist = "David Chavez" + viewModel.maxTime = 0 + + return PlayerView(viewModel: viewModel) +} diff --git a/Package.swift b/Package.swift index fc6448d..bf20c91 100644 --- a/Package.swift +++ b/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "SwiftAudioEx", - platforms: [.iOS(.v11), .macOS(.v11)], + platforms: [.iOS(.v11), .macOS(.v11), .watchOS(.v6)], products: [ .library( name: "SwiftAudioEx", diff --git a/README.md b/README.md index 466bd62..41e3fa6 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ device). ## Requirements -iOS 11.0+ +iOS 11.0+, watchOS 6.0+ ## Installation diff --git a/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift b/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift index a7b168e..f64896e 100755 --- a/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift +++ b/Sources/SwiftAudioEx/AVPlayerWrapper/AVPlayerWrapper.swift @@ -408,7 +408,10 @@ class AVPlayerWrapper: AVPlayerWrapperProtocol { private func setupAVPlayer() { // disabled since we're not making use of video playback + #if !os(watchOS) avPlayer.allowsExternalPlayback = false; + #endif + playerObserver.player = avPlayer playerObserver.startObserving() diff --git a/Sources/SwiftAudioEx/AudioItem.swift b/Sources/SwiftAudioEx/AudioItem.swift index 0544750..42c7c1b 100755 --- a/Sources/SwiftAudioEx/AudioItem.swift +++ b/Sources/SwiftAudioEx/AudioItem.swift @@ -8,7 +8,7 @@ import Foundation import AVFoundation -#if os(iOS) +#if canImport(UIKit) import UIKit public typealias AudioItemImage = UIImage #elseif os(macOS) diff --git a/SwiftAudioEx.podspec b/SwiftAudioEx.podspec index 32c2e0f..0e168cb 100644 --- a/SwiftAudioEx.podspec +++ b/SwiftAudioEx.podspec @@ -21,6 +21,7 @@ DESC s.source = { :git => 'https://github.com/DoubleSymmetry/SwiftAudioEx.git', :tag => s.version.to_s } s.ios.deployment_target = '11.0' + s.watchos.deployment_target = '6.0' s.swift_version = '5.0' s.source_files = 'Sources/SwiftAudioEx/**/*' end