diff --git a/EMTLoadingIndicator/Classes/EMTLoadingIndicator.swift b/EMTLoadingIndicator/Classes/EMTLoadingIndicator.swift index eb0a31c..90a411f 100644 --- a/EMTLoadingIndicator/Classes/EMTLoadingIndicator.swift +++ b/EMTLoadingIndicator/Classes/EMTLoadingIndicator.swift @@ -6,7 +6,9 @@ // import UIKit +#if !os(iOS) import WatchKit +#endif @objc final public class EMTLoadingIndicator: NSObject { @@ -61,7 +63,11 @@ final public class EMTLoadingIndicator: NSObject { private func prepareImagesForWaitStyleDot() { if EMTLoadingIndicator.dotWaitImage == nil { + #if SWIFT_PACKAGE + let bundle = Bundle.module + #else let bundle = Bundle(for: EMTLoadingIndicator.self) + #endif let cursors: [UIImage] = (0...29).map { let index = $0 return UIImage(contentsOfFile: (bundle.path(forResource: "waitIndicatorGraphic-\(index)@2x", ofType: "png"))!)! diff --git a/EMTLoadingIndicator/Classes/EMTTimer.swift b/EMTLoadingIndicator/Classes/EMTTimer.swift index 73facf2..e8160b9 100644 --- a/EMTLoadingIndicator/Classes/EMTTimer.swift +++ b/EMTLoadingIndicator/Classes/EMTTimer.swift @@ -5,7 +5,9 @@ // Copyright (C) 2016 emotionale. All rights reserved. // +#if !os(iOS) import WatchKit +#endif typealias EMTTimerCallback = (Timer) -> Void diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..7e283c3 --- /dev/null +++ b/Package.swift @@ -0,0 +1,27 @@ +// swift-tools-version:5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let package = Package( + name: "EMTLoadingIndicator", + platforms: [ + .watchOS(.v4) + ], + products: [ + .library( + name: "EMTLoadingIndicator", + targets: ["EMTLoadingIndicator"]) + ], + targets: [ + .target( + name: "EMTLoadingIndicator", + path: ".", + exclude: ["LICENSE", + "README.md", + "waitIndicatorGraphic.fla", + "EMTLoadingIndicator/Info.plist", + "EMTLoadingIndicator.podspec"], + sources: ["EMTLoadingIndicator/Classes"], + resources: [.process("EMTLoadingIndicator/Resources")]) + ] +)