Skip to content

Commit

Permalink
Added more for spinner preset.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Dec 23, 2021
1 parent 06d3152 commit 1c1341e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Once you have your Swift package set up, adding as a dependency is as easy as ad

```swift
dependencies: [
.package(url: "https://github.com/ivanvorobei/SPAlert", .upToNextMajor(from: "4.0.1"))
.package(url: "https://github.com/ivanvorobei/SPAlert", .upToNextMajor(from: "4.1.0"))
]
```

Expand Down
2 changes: 1 addition & 1 deletion SPAlert.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'SPAlert'
s.version = '4.0.1'
s.version = '4.1.0'
s.summary = 'Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets. Support SwiftUI.'
s.homepage = 'https://github.com/ivanvorobei/SPAlert'
s.source = { :git => 'https://github.com/ivanvorobei/SPAlert.git', :tag => s.version }
Expand Down
10 changes: 10 additions & 0 deletions Sources/SPAlert/SPAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ public enum SPAlert {
alertView.present(haptic: haptic, completion: completion)
}

/**
SPAlert: Show present only.

- parameter completion: Will call with dismiss alert.
*/
public static func present(preset: SPAlertIconPreset, completion: (() -> Void)? = nil) {
let alertView = SPAlertView(preset: preset)
alertView.present(haptic: preset.haptic, completion: completion)
}

/**
SPAlert: Dismiss all `SPAlert` views.
*/
Expand Down
12 changes: 8 additions & 4 deletions Sources/SPAlert/SPAlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ open class SPAlertView: UIView {

// MARK: - Init

public init(title: String, message: String? = nil, preset: SPAlertIconPreset) {
super.init(frame: CGRect.zero)
commonInit()
layout = SPAlertLayout(for: preset)
public convenience init(title: String, message: String? = nil, preset: SPAlertIconPreset) {
self.init(preset: preset)
setTitle(title)
if let message = message {
setMessage(message)
Expand All @@ -106,6 +104,12 @@ open class SPAlertView: UIView {
}
}

public init(preset: SPAlertIconPreset) {
super.init(frame: CGRect.zero)
commonInit()
layout = SPAlertLayout(for: preset)
}

public init(message: String) {
super.init(frame: CGRect.zero)
commonInit()
Expand Down

0 comments on commit 1c1341e

Please sign in to comment.