From b5c3bded1711c66096ff7cb44f53085d53f17c6a Mon Sep 17 00:00:00 2001 From: Zandor Smith Date: Mon, 8 Nov 2021 22:52:25 +0100 Subject: [PATCH] Add support for iOS 12. --- Package.swift | 2 +- Sources/Toast/Toast.swift | 10 +++++++++- .../ToastViews/AppleToastView/IconAppleToastView.swift | 10 +++++++++- ToastViewSwift.podspec | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 2a875e9..0d7b533 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ import PackageDescription let package = Package( name: "Toast", platforms: [ - .iOS(.v13) + .iOS(.v12) ], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. diff --git a/Sources/Toast/Toast.swift b/Sources/Toast/Toast.swift index 8052f98..161b1c9 100644 --- a/Sources/Toast/Toast.swift +++ b/Sources/Toast/Toast.swift @@ -8,6 +8,14 @@ import UIKit public class Toast { + public static var defaultImageTint: UIColor { + if #available(iOS 13.0, *) { + return .label + } else { + return .black + } + } + public let view: ToastView private let config: ToastConfiguration @@ -41,7 +49,7 @@ public class Toast { /// - Returns: A new Toast view with the configured layout public static func `default`( image: UIImage, - imageTint: UIColor? = .label, + imageTint: UIColor? = defaultImageTint, title: String, subtitle: String? = nil, config: ToastConfiguration = ToastConfiguration() diff --git a/Sources/Toast/ToastViews/AppleToastView/IconAppleToastView.swift b/Sources/Toast/ToastViews/AppleToastView/IconAppleToastView.swift index f6ab802..3f57a38 100644 --- a/Sources/Toast/ToastViews/AppleToastView/IconAppleToastView.swift +++ b/Sources/Toast/ToastViews/AppleToastView/IconAppleToastView.swift @@ -9,7 +9,15 @@ import Foundation import UIKit public class IconAppleToastView : UIStackView { - public init(image: UIImage, imageTint: UIColor? = .label, title: String, subtitle: String? = nil) { + public static var defaultImageTint: UIColor { + if #available(iOS 13.0, *) { + return .label + } else { + return .black + } + } + + public init(image: UIImage, imageTint: UIColor? = defaultImageTint, title: String, subtitle: String? = nil) { super.init(frame: CGRect.zero) axis = .horizontal spacing = 15 diff --git a/ToastViewSwift.podspec b/ToastViewSwift.podspec index 7aee06a..c51a917 100644 --- a/ToastViewSwift.podspec +++ b/ToastViewSwift.podspec @@ -65,7 +65,7 @@ Pod::Spec.new do |spec| # # spec.platform = :ios - spec.platform = :ios, "13.0" + spec.platform = :ios, "12.0" # When using multiple platforms # spec.ios.deployment_target = "5.0"