Skip to content

Commit 05bbae6

Browse files
committed
Add .moon & .star presets
1 parent 41e07c9 commit 05bbae6

15 files changed

+293
-12
lines changed

Assets/Readme/Miniature - Add.svg

Lines changed: 3 additions & 3 deletions
Loading

Assets/Readme/Miniature - Moon.svg

Lines changed: 10 additions & 0 deletions
Loading

Assets/Readme/Miniature - Star.svg

Lines changed: 10 additions & 0 deletions
Loading

Assets/Sketch/Presets.sketch

5.68 KB
Binary file not shown.

Example/Controllers/ViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class ViewController: UITableViewController {
88
Alert(key: "Heart", preset: .heart, title: "Love", subtitle: "We'll recommend more like this for you"),
99
Alert(key: "Doc", preset: .doc, title: "Document saved", subtitle: "See in folder new file"),
1010
Alert(key: "Bookmark", preset: .bookmark, title: "Added to bookmark", subtitle: "See bookmarks screen"),
11+
Alert(key: "Moon", preset: .moon, title: "Night Mode", subtitle: "You can disable it in settings"),
12+
Alert(key: "Star", preset: .star, title: "Added to favorite", subtitle: nil),
1113
Alert(key: "Add", preset: .add, title: "Added to Folder", subtitle: nil),
1214
Alert(key: "Error", preset: .error, title: "Oops", subtitle: "Please try again later"),
1315
Alert(key: "Message", preset: nil, title: nil, subtitle: "Email required")

Readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ For now supporting `Done`, `Add`, `Heart`, `Doc`, `Error`, `Bookmark` & `Message
8080
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Heart.svg" width="80">
8181
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Doc.svg" width="80">
8282
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Bookmark.svg" width="80">
83+
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Moon.svg" width="80">
84+
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Star.svg" width="80">
8385
<img src="https://github.com/ivanvorobei/SPAlert/blob/master/Assets/Readme/Miniature%20-%20Error.svg" width="80">
8486
</p>
8587

SPAlert.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "SPAlert"
4-
s.version = "2.0.5"
4+
s.version = "2.0.6"
55
s.summary = "Native alert from Apple Music & Feedback. Contains Done, Heart & Message presets."
66
s.homepage = "https://github.com/IvanVorobei/SPAlert"
77
s.source = { :git => "https://github.com/IvanVorobei/SPAlert.git", :tag => s.version }

SPAlert.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
F4A5A92C2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A5A92B2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift */; };
2727
F4A8361A2385588300EB32E0 /* SPAlertIconDocView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A836192385588300EB32E0 /* SPAlertIconDocView.swift */; };
2828
F4CA67B5238ABD0100E72F79 /* SPAlertIconAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4CA67B4238ABD0100E72F79 /* SPAlertIconAddView.swift */; };
29+
F4D3CD58238DA9FE006C3DE2 /* SPAlertIconMoonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D3CD57238DA9FE006C3DE2 /* SPAlertIconMoonView.swift */; };
30+
F4D3CD5A238DAA49006C3DE2 /* SPAlertIconStarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4D3CD59238DAA49006C3DE2 /* SPAlertIconStarView.swift */; };
2931
/* End PBXBuildFile section */
3032

3133
/* Begin PBXContainerItemProxy section */
@@ -80,6 +82,8 @@
8082
F4A5A92B2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconBookmarkView.swift; sourceTree = "<group>"; };
8183
F4A836192385588300EB32E0 /* SPAlertIconDocView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconDocView.swift; sourceTree = "<group>"; };
8284
F4CA67B4238ABD0100E72F79 /* SPAlertIconAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconAddView.swift; sourceTree = "<group>"; };
85+
F4D3CD57238DA9FE006C3DE2 /* SPAlertIconMoonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconMoonView.swift; sourceTree = "<group>"; };
86+
F4D3CD59238DAA49006C3DE2 /* SPAlertIconStarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconStarView.swift; sourceTree = "<group>"; };
8387
/* End PBXFileReference section */
8488

8589
/* Begin PBXFrameworksBuildPhase section */
@@ -163,6 +167,8 @@
163167
F4A836192385588300EB32E0 /* SPAlertIconDocView.swift */,
164168
F4A5A92B2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift */,
165169
F4CA67B4238ABD0100E72F79 /* SPAlertIconAddView.swift */,
170+
F4D3CD57238DA9FE006C3DE2 /* SPAlertIconMoonView.swift */,
171+
F4D3CD59238DAA49006C3DE2 /* SPAlertIconStarView.swift */,
166172
);
167173
path = Icons;
168174
sourceTree = "<group>";
@@ -364,6 +370,8 @@
364370
F4A5A92C2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift in Sources */,
365371
F41204EC2382AC9B009C2AC7 /* SPAlertIconDoneView.swift in Sources */,
366372
F41204E92382AC9B009C2AC7 /* SPAlertView.swift in Sources */,
373+
F4D3CD58238DA9FE006C3DE2 /* SPAlertIconMoonView.swift in Sources */,
374+
F4D3CD5A238DAA49006C3DE2 /* SPAlertIconStarView.swift in Sources */,
367375
706F894A2383277500ECF5D1 /* SPAlertIconErrorView.swift in Sources */,
368376
F41205292382AF5C009C2AC7 /* SPAlertIconAnimatable.swift in Sources */,
369377
F4CA67B5238ABD0100E72F79 /* SPAlertIconAddView.swift in Sources */,

Source/SPAlert/Models/SPAlertPreset.swift

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public enum SPAlertPreset {
3030
case heart
3131
case doc
3232
case bookmark
33+
case moon
34+
case star
3335
case add
3436
case error
3537

@@ -48,6 +50,10 @@ public enum SPAlertPreset {
4850
return SPAlertIconBookmarkView()
4951
case .add:
5052
return SPAlertIconAddView()
53+
case .moon:
54+
return SPAlertIconMoonView()
55+
case .star:
56+
return SPAlertIconStarView()
5157
case .error:
5258
return SPAlertIconErrorView()
5359
}
@@ -87,9 +93,25 @@ public enum SPAlertPreset {
8793
layout.topSpace = 57
8894
layout.bottomSpace = 29
8995
layout.iconWidth = 112
90-
layout.iconHeight = 94
96+
layout.iconHeight = 90
9197
layout.bottomIconSpace = 36
9298
return layout
99+
case .moon:
100+
var layout = SPAlertLayout()
101+
layout.topSpace = 49
102+
layout.bottomSpace = 27
103+
layout.iconWidth = 112
104+
layout.iconHeight = 88
105+
layout.bottomIconSpace = 35
106+
return layout
107+
case .star:
108+
var layout = SPAlertLayout()
109+
layout.topSpace = 49
110+
layout.bottomSpace = 31
111+
layout.iconWidth = 112
112+
layout.iconHeight = 92
113+
layout.bottomIconSpace = 35
114+
return layout
93115
case .add:
94116
var layout = SPAlertLayout()
95117
layout.topSpace = 63
@@ -124,6 +146,10 @@ public enum SPAlertPreset {
124146
return .success
125147
case .add:
126148
return .success
149+
case .star:
150+
return .success
151+
case .moon:
152+
return .success
127153
case .error:
128154
return .error
129155
}

Source/SPAlert/Views/Icons/SPAlertIconDocView.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,11 @@ public class SPAlertIconDocView: UIView {
4040
class DocDraw: NSObject {
4141

4242
@objc dynamic public class func draw(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 70, height: 87), resizing: ResizingBehavior = .aspectFit, fillColor: UIColor = UIColor(red: 0.349, green: 0.345, blue: 0.353, alpha: 1.000)) {
43-
4443
let context = UIGraphicsGetCurrentContext()!
45-
4644
context.saveGState()
4745
let resizedFrame: CGRect = resizing.apply(rect: CGRect(x: 0, y: 0, width: 70, height: 87), target: targetFrame)
4846
context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
4947
context.scaleBy(x: resizedFrame.width / 70, y: resizedFrame.height / 87)
50-
5148
let bezierPath = UIBezierPath()
5249
bezierPath.move(to: CGPoint(x: 13.73, y: 86.65))
5350
bezierPath.addLine(to: CGPoint(x: 55.38, y: 86.65))

0 commit comments

Comments
 (0)