Skip to content

Commit

Permalink
Add support for iOS 12.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zandor300 committed Nov 8, 2021
1 parent 4d5b82b commit b5c3bde
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 9 additions & 1 deletion Sources/Toast/Toast.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ToastViewSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b5c3bde

Please sign in to comment.