diff --git a/Assets/Readme/Miniature - Dislike.svg b/Assets/Readme/Miniature - Dislike.svg
new file mode 100644
index 0000000..1a4ce0b
--- /dev/null
+++ b/Assets/Readme/Miniature - Dislike.svg
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/Assets/Readme/Miniature - Privacy.svg b/Assets/Readme/Miniature - Privacy.svg
new file mode 100644
index 0000000..2437e8d
--- /dev/null
+++ b/Assets/Readme/Miniature - Privacy.svg
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/Assets/Sketch/Presets.sketch b/Assets/Sketch/Presets.sketch
index 115f574..0a764f2 100644
Binary files a/Assets/Sketch/Presets.sketch and b/Assets/Sketch/Presets.sketch differ
diff --git a/Example/Controllers/ViewController.swift b/Example/Controllers/ViewController.swift
index 1c62021..02b8502 100644
--- a/Example/Controllers/ViewController.swift
+++ b/Example/Controllers/ViewController.swift
@@ -18,6 +18,8 @@ class ViewController: UITableViewController {
Alert(key: "Eject", preset: .eject, title: "Eject complete", subtitle: nil),
Alert(key: "Card", preset: .card, title: "Payment sent", subtitle: "Thanks for donate"),
Alert(key: "Like", preset: .like, title: "Thanks for feedback", subtitle: "It helped us"),
+ Alert(key: "Dislike", preset: .dislike, title: "Thanks for feedback", subtitle: "It helped us"),
+ Alert(key: "Privacy", preset: .privacy, title: "Privacy accepted", subtitle: "You privacy it important"),
Alert(key: "Rotate", preset: .rotate, title: "Portrait mode", subtitle: "You can change it in settings"),
Alert(key: "Magic", preset: .magic, title: "Magic here! You see", subtitle: "Strange text, true?"),
Alert(key: "Add", preset: .add, title: "Added to Folder", subtitle: nil),
diff --git a/Readme.md b/Readme.md
index c5f519d..4c473bb 100644
--- a/Readme.md
+++ b/Readme.md
@@ -23,6 +23,8 @@ And other
+
+
diff --git a/SPAlert.podspec b/SPAlert.podspec
index ea44f89..6111a18 100644
--- a/SPAlert.podspec
+++ b/SPAlert.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "SPAlert"
- s.version = "2.0.24"
+ s.version = "2.0.25"
s.summary = "Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets."
s.homepage = "https://github.com/IvanVorobei/SPAlert"
s.source = { :git => "https://github.com/IvanVorobei/SPAlert.git", :tag => s.version }
diff --git a/SPAlert.xcodeproj/project.pbxproj b/SPAlert.xcodeproj/project.pbxproj
index 3071761..663e53d 100644
--- a/SPAlert.xcodeproj/project.pbxproj
+++ b/SPAlert.xcodeproj/project.pbxproj
@@ -26,6 +26,8 @@
F412052B2382AF64009C2AC7 /* SPAlertLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F41205222382AEFA009C2AC7 /* SPAlertLayout.swift */; };
F4146EB223AAA18100AE7658 /* SPAlertIconLikeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4146EB123AAA18100AE7658 /* SPAlertIconLikeView.swift */; };
F421EFF12398684E000A566D /* SPAlertIconFlagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F421EFF02398684E000A566D /* SPAlertIconFlagView.swift */; };
+ F42DE05423AD7D8A007CCE29 /* SPAlertIconDislikeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42DE05323AD7D8A007CCE29 /* SPAlertIconDislikeView.swift */; };
+ F42DE05623AD7D94007CCE29 /* SPAlertIconPrivacyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F42DE05523AD7D94007CCE29 /* SPAlertIconPrivacyView.swift */; };
F45970B423A578A50092CE7C /* SPAlertIconCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F45970B323A578A50092CE7C /* SPAlertIconCardView.swift */; };
F459720223A841C00092CE7C /* SPAlertIconRotateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F459720123A841C00092CE7C /* SPAlertIconRotateView.swift */; };
F46AAEFE2392E97200BE9131 /* SPAlertIconMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F46AAEFD2392E97200BE9131 /* SPAlertIconMessageView.swift */; };
@@ -94,6 +96,8 @@
F41205262382AF29009C2AC7 /* SPAlertIconAnimatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconAnimatable.swift; sourceTree = ""; };
F4146EB123AAA18100AE7658 /* SPAlertIconLikeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconLikeView.swift; sourceTree = ""; };
F421EFF02398684E000A566D /* SPAlertIconFlagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconFlagView.swift; sourceTree = ""; };
+ F42DE05323AD7D8A007CCE29 /* SPAlertIconDislikeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconDislikeView.swift; sourceTree = ""; };
+ F42DE05523AD7D94007CCE29 /* SPAlertIconPrivacyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconPrivacyView.swift; sourceTree = ""; };
F45970B323A578A50092CE7C /* SPAlertIconCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconCardView.swift; sourceTree = ""; };
F459720123A841C00092CE7C /* SPAlertIconRotateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconRotateView.swift; sourceTree = ""; };
F46AAEFD2392E97200BE9131 /* SPAlertIconMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPAlertIconMessageView.swift; sourceTree = ""; };
@@ -205,6 +209,8 @@
F45970B323A578A50092CE7C /* SPAlertIconCardView.swift */,
F459720123A841C00092CE7C /* SPAlertIconRotateView.swift */,
F4146EB123AAA18100AE7658 /* SPAlertIconLikeView.swift */,
+ F42DE05323AD7D8A007CCE29 /* SPAlertIconDislikeView.swift */,
+ F42DE05523AD7D94007CCE29 /* SPAlertIconPrivacyView.swift */,
);
path = Icons;
sourceTree = "";
@@ -408,6 +414,7 @@
F41204EA2382AC9B009C2AC7 /* SPAlertPreset.swift in Sources */,
F4A5A92C2388792F00B0DFE0 /* SPAlertIconBookmarkView.swift in Sources */,
F47D2FA6239D718400A346A5 /* SPAlertIconBoltView.swift in Sources */,
+ F42DE05423AD7D8A007CCE29 /* SPAlertIconDislikeView.swift in Sources */,
F41204EC2382AC9B009C2AC7 /* SPAlertIconDoneView.swift in Sources */,
F41204E92382AC9B009C2AC7 /* SPAlertView.swift in Sources */,
F421EFF12398684E000A566D /* SPAlertIconFlagView.swift in Sources */,
@@ -419,6 +426,7 @@
F41205292382AF5C009C2AC7 /* SPAlertIconAnimatable.swift in Sources */,
F4D1623423A2E47200B5E3E9 /* SPAlertIconEjectView.swift in Sources */,
F46AAEFE2392E97200BE9131 /* SPAlertIconMessageView.swift in Sources */,
+ F42DE05623AD7D94007CCE29 /* SPAlertIconPrivacyView.swift in Sources */,
F4CA67B5238ABD0100E72F79 /* SPAlertIconAddView.swift in Sources */,
F41204EB2382AC9B009C2AC7 /* SPAlertIconHeartView.swift in Sources */,
F4A8361A2385588300EB32E0 /* SPAlertIconDocView.swift in Sources */,
diff --git a/Source/SPAlert/Models/SPAlertPreset.swift b/Source/SPAlert/Models/SPAlertPreset.swift
index 220c238..b32e1c4 100644
--- a/Source/SPAlert/Models/SPAlertPreset.swift
+++ b/Source/SPAlert/Models/SPAlertPreset.swift
@@ -46,6 +46,8 @@ public enum SPAlertPreset {
case card
case rotate
case like
+ case dislike
+ case privacy
/**
View for preset. Wrap to `UIView`.
@@ -92,6 +94,10 @@ public enum SPAlertPreset {
return SPAlertIconRotateView()
case .like:
return SPAlertIconLikeView()
+ case .dislike:
+ return SPAlertIconDislikeView()
+ case .privacy:
+ return SPAlertIconPrivacyView()
}
}
@@ -189,6 +195,22 @@ public enum SPAlertPreset {
layout.iconHeight = 88
layout.bottomIconSpace = 35
return layout
+ case .dislike:
+ var layout = SPAlertLayout()
+ layout.topSpace = 49
+ layout.bottomSpace = 31
+ layout.iconWidth = 112
+ layout.iconHeight = 88
+ layout.bottomIconSpace = 35
+ return layout
+ case .privacy:
+ var layout = SPAlertLayout()
+ layout.topSpace = 47
+ layout.bottomSpace = 31
+ layout.iconWidth = 106
+ layout.iconHeight = 106
+ layout.bottomIconSpace = 32
+ return layout
case .bookmark:
var layout = SPAlertLayout()
layout.topSpace = 57
@@ -309,6 +331,10 @@ public enum SPAlertPreset {
return .success
case .like:
return .success
+ case .dislike:
+ return .error
+ case .privacy:
+ return .success
}
}
}
diff --git a/Source/SPAlert/Views/Icons/SPAlertIconDislikeView.swift b/Source/SPAlert/Views/Icons/SPAlertIconDislikeView.swift
new file mode 100644
index 0000000..5e95883
--- /dev/null
+++ b/Source/SPAlert/Views/Icons/SPAlertIconDislikeView.swift
@@ -0,0 +1,137 @@
+// The MIT License (MIT)
+// Copyright © 2019 Ivan Vorobei (ivanvorobei@icloud.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+import UIKit
+
+public class SPAlertIconDislikeView: UIView {
+
+ init() {
+ super.init(frame: .zero)
+ self.backgroundColor = .clear
+ }
+
+ required init?(coder aDecoder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ public override func draw(_ rect: CGRect) {
+ super.draw(rect)
+ DislikeDraw.draw(frame: rect, resizing: .aspectFit, fillColor: self.tintColor)
+ }
+
+ class DislikeDraw: NSObject {
+
+ @objc dynamic public class func draw(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 60, height: 56), resizing: ResizingBehavior = .aspectFit, fillColor: UIColor = UIColor(red: 0.349, green: 0.345, blue: 0.353, alpha: 1.000)) {
+ let context = UIGraphicsGetCurrentContext()!
+ context.saveGState()
+ let resizedFrame: CGRect = resizing.apply(rect: CGRect(x: 0, y: 0, width: 61, height: 64), target: targetFrame)
+ context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
+ context.scaleBy(x: resizedFrame.width / 61, y: resizedFrame.height / 64)
+ context.saveGState()
+ context.beginTransparencyLayer(auxiliaryInfo: nil)
+ let clipPath = UIBezierPath()
+ clipPath.move(to: CGPoint(x: 11.03, y: 4.6))
+ clipPath.addLine(to: CGPoint(x: 10.83, y: 4.64))
+ clipPath.addCurve(to: CGPoint(x: 6.47, y: 9.26), controlPoint1: CGPoint(x: 8.65, y: 5.18), controlPoint2: CGPoint(x: 6.47, y: 6.57))
+ clipPath.addCurve(to: CGPoint(x: 7.14, y: 11.74), controlPoint1: CGPoint(x: 6.47, y: 10.35), controlPoint2: CGPoint(x: 6.75, y: 11.13))
+ clipPath.addCurve(to: CGPoint(x: 7.08, y: 12.49), controlPoint1: CGPoint(x: 7.35, y: 12.08), controlPoint2: CGPoint(x: 7.34, y: 12.34))
+ clipPath.addLine(to: CGPoint(x: 7, y: 12.53))
+ clipPath.addCurve(to: CGPoint(x: 3.76, y: 17.14), controlPoint1: CGPoint(x: 5.24, y: 13.31), controlPoint2: CGPoint(x: 3.76, y: 14.9))
+ clipPath.addCurve(to: CGPoint(x: 4.61, y: 20.17), controlPoint1: CGPoint(x: 3.76, y: 18.33), controlPoint2: CGPoint(x: 4.07, y: 19.38))
+ clipPath.addLine(to: CGPoint(x: 4.74, y: 20.35))
+ clipPath.addCurve(to: CGPoint(x: 4.52, y: 21.42), controlPoint1: CGPoint(x: 5.07, y: 20.77), controlPoint2: CGPoint(x: 4.99, y: 21.14))
+ clipPath.addCurve(to: CGPoint(x: 2.36, y: 25.61), controlPoint1: CGPoint(x: 3.2, y: 22.14), controlPoint2: CGPoint(x: 2.36, y: 23.76))
+ clipPath.addCurve(to: CGPoint(x: 3.42, y: 28.88), controlPoint1: CGPoint(x: 2.36, y: 26.84), controlPoint2: CGPoint(x: 2.73, y: 28.14))
+ clipPath.addLine(to: CGPoint(x: 3.57, y: 29.02))
+ clipPath.addCurve(to: CGPoint(x: 3.52, y: 30), controlPoint1: CGPoint(x: 3.96, y: 29.38), controlPoint2: CGPoint(x: 3.91, y: 29.65))
+ clipPath.addLine(to: CGPoint(x: 3.43, y: 30.08))
+ clipPath.addCurve(to: CGPoint(x: 2, y: 33.71), controlPoint1: CGPoint(x: 2.5, y: 30.78), controlPoint2: CGPoint(x: 2, y: 32.12))
+ clipPath.addCurve(to: CGPoint(x: 6.89, y: 38.69), controlPoint1: CGPoint(x: 2, y: 36.45), controlPoint2: CGPoint(x: 4.12, y: 38.69))
+ clipPath.addLine(to: CGPoint(x: 16.87, y: 38.69))
+ clipPath.addCurve(to: CGPoint(x: 21.09, y: 42.07), controlPoint1: CGPoint(x: 19.41, y: 38.69), controlPoint2: CGPoint(x: 21.09, y: 39.97))
+ clipPath.addCurve(to: CGPoint(x: 16.34, y: 57.86), controlPoint1: CGPoint(x: 21.09, y: 45.9), controlPoint2: CGPoint(x: 16.34, y: 52.83))
+ clipPath.addCurve(to: CGPoint(x: 20.25, y: 62), controlPoint1: CGPoint(x: 16.34, y: 60.46), controlPoint2: CGPoint(x: 18.04, y: 62))
+ clipPath.addCurve(to: CGPoint(x: 24.39, y: 58.48), controlPoint1: CGPoint(x: 22.26, y: 62), controlPoint2: CGPoint(x: 23.3, y: 60.6))
+ clipPath.addCurve(to: CGPoint(x: 38.48, y: 37.96), controlPoint1: CGPoint(x: 28.53, y: 50.26), controlPoint2: CGPoint(x: 34.17, y: 43.66))
+ clipPath.addCurve(to: CGPoint(x: 43.98, y: 22.34), controlPoint1: CGPoint(x: 42.11, y: 33.13), controlPoint2: CGPoint(x: 43.9, y: 29.02))
+ clipPath.addCurve(to: CGPoint(x: 23.02, y: 4.06), controlPoint1: CGPoint(x: 44.12, y: 12.1), controlPoint2: CGPoint(x: 35.93, y: 4.3))
+ clipPath.addLine(to: CGPoint(x: 18.74, y: 4))
+ clipPath.addCurve(to: CGPoint(x: 11.03, y: 4.6), controlPoint1: CGPoint(x: 15.23, y: 3.98), controlPoint2: CGPoint(x: 12.61, y: 4.23))
+ clipPath.addLine(to: CGPoint(x: 11.03, y: 4.6))
+ clipPath.close()
+ clipPath.move(to: CGPoint(x: 57.73, y: 22.11))
+ clipPath.addCurve(to: CGPoint(x: 46.55, y: 37.63), controlPoint1: CGPoint(x: 57.73, y: 30.83), controlPoint2: CGPoint(x: 52.87, y: 37.63))
+ clipPath.addLine(to: CGPoint(x: 42.44, y: 37.63))
+ clipPath.addCurve(to: CGPoint(x: 47.78, y: 22.39), controlPoint1: CGPoint(x: 44.93, y: 34.55), controlPoint2: CGPoint(x: 47.67, y: 29.49))
+ clipPath.addCurve(to: CGPoint(x: 40.52, y: 6.71), controlPoint1: CGPoint(x: 47.9, y: 16.02), controlPoint2: CGPoint(x: 45.58, y: 10.43))
+ clipPath.addLine(to: CGPoint(x: 45.52, y: 6.71))
+ clipPath.addCurve(to: CGPoint(x: 57.73, y: 22.11), controlPoint1: CGPoint(x: 52.51, y: 6.71), controlPoint2: CGPoint(x: 57.73, y: 13.73))
+ clipPath.close()
+ clipPath.addClip()
+ let rectanglePath = UIBezierPath(rect: CGRect(x: -3.02, y: -1, width: 65.75, height: 68))
+ fillColor.setFill()
+ rectanglePath.fill()
+ context.endTransparencyLayer()
+ context.restoreGState()
+ context.restoreGState()
+ }
+
+ @objc(StyleKitNameResizingBehavior)
+ public enum ResizingBehavior: Int {
+
+ case aspectFit
+ case aspectFill
+ case stretch
+ case center
+
+ public func apply(rect: CGRect, target: CGRect) -> CGRect {
+ if rect == target || target == CGRect.zero {
+ return rect
+ }
+
+ var scales = CGSize.zero
+ scales.width = abs(target.width / rect.width)
+ scales.height = abs(target.height / rect.height)
+
+ switch self {
+ case .aspectFit:
+ scales.width = min(scales.width, scales.height)
+ scales.height = scales.width
+ case .aspectFill:
+ scales.width = max(scales.width, scales.height)
+ scales.height = scales.width
+ case .stretch:
+ break
+ case .center:
+ scales.width = 1
+ scales.height = 1
+ }
+
+ var result = rect.standardized
+ result.size.width *= scales.width
+ result.size.height *= scales.height
+ result.origin.x = target.minX + (target.width - result.width) / 2
+ result.origin.y = target.minY + (target.height - result.height) / 2
+ return result
+ }
+ }
+ }
+}
diff --git a/Source/SPAlert/Views/Icons/SPAlertIconPrivacyView.swift b/Source/SPAlert/Views/Icons/SPAlertIconPrivacyView.swift
new file mode 100644
index 0000000..b3e655e
--- /dev/null
+++ b/Source/SPAlert/Views/Icons/SPAlertIconPrivacyView.swift
@@ -0,0 +1,124 @@
+// The MIT License (MIT)
+// Copyright © 2019 Ivan Vorobei (ivanvorobei@icloud.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+import UIKit
+
+public class SPAlertIconPrivacyView: UIView {
+
+ init() {
+ super.init(frame: .zero)
+ self.backgroundColor = .clear
+ }
+
+ required init?(coder aDecoder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ public override func draw(_ rect: CGRect) {
+ super.draw(rect)
+ PrivacyDraw.draw(frame: rect, resizing: .aspectFit, fillColor: self.tintColor)
+ }
+
+ class PrivacyDraw: NSObject {
+
+ @objc dynamic public class func draw(frame targetFrame: CGRect = CGRect(x: 0, y: 0, width: 60, height: 56), resizing: ResizingBehavior = .aspectFit, fillColor: UIColor = UIColor(red: 0.349, green: 0.345, blue: 0.353, alpha: 1.000)) {
+ let context = UIGraphicsGetCurrentContext()!
+ context.saveGState()
+ let resizedFrame: CGRect = resizing.apply(rect: CGRect(x: 0, y: 0, width: 55, height: 70), target: targetFrame)
+ context.translateBy(x: resizedFrame.minX, y: resizedFrame.minY)
+ context.scaleBy(x: resizedFrame.width / 55, y: resizedFrame.height / 70)
+ let bezierPath = UIBezierPath()
+ bezierPath.move(to: CGPoint(x: 5, y: 45.54))
+ bezierPath.addLine(to: CGPoint(x: 5, y: 18.3))
+ bezierPath.addCurve(to: CGPoint(x: 7.99, y: 15.34), controlPoint1: CGPoint(x: 5, y: 16.74), controlPoint2: CGPoint(x: 5.97, y: 15.34))
+ bezierPath.addCurve(to: CGPoint(x: 10.86, y: 18.3), controlPoint1: CGPoint(x: 9.95, y: 15.34), controlPoint2: CGPoint(x: 10.86, y: 16.74))
+ bezierPath.addLine(to: CGPoint(x: 10.86, y: 36.7))
+ bezierPath.addCurve(to: CGPoint(x: 14.05, y: 35.05), controlPoint1: CGPoint(x: 11.83, y: 36.08), controlPoint2: CGPoint(x: 12.91, y: 35.52))
+ bezierPath.addLine(to: CGPoint(x: 14.05, y: 9.19))
+ bezierPath.addCurve(to: CGPoint(x: 16.98, y: 6.23), controlPoint1: CGPoint(x: 14.05, y: 7.63), controlPoint2: CGPoint(x: 15.05, y: 6.23))
+ bezierPath.addCurve(to: CGPoint(x: 19.91, y: 9.19), controlPoint1: CGPoint(x: 18.92, y: 6.23), controlPoint2: CGPoint(x: 19.91, y: 7.63))
+ bezierPath.addLine(to: CGPoint(x: 19.91, y: 33.41))
+ bezierPath.addCurve(to: CGPoint(x: 23.11, y: 33.06), controlPoint1: CGPoint(x: 20.97, y: 33.24), controlPoint2: CGPoint(x: 22.02, y: 33.12))
+ bezierPath.addLine(to: CGPoint(x: 23.11, y: 6.93))
+ bezierPath.addCurve(to: CGPoint(x: 26.04, y: 4), controlPoint1: CGPoint(x: 23.11, y: 5.38), controlPoint2: CGPoint(x: 24.07, y: 4))
+ bezierPath.addCurve(to: CGPoint(x: 28.96, y: 6.93), controlPoint1: CGPoint(x: 28, y: 4), controlPoint2: CGPoint(x: 28.96, y: 5.38))
+ bezierPath.addLine(to: CGPoint(x: 28.96, y: 33.27))
+ bezierPath.addCurve(to: CGPoint(x: 32.16, y: 33.91), controlPoint1: CGPoint(x: 30.14, y: 33.41), controlPoint2: CGPoint(x: 31.22, y: 33.65))
+ bezierPath.addLine(to: CGPoint(x: 32.16, y: 10.77))
+ bezierPath.addCurve(to: CGPoint(x: 35.09, y: 7.81), controlPoint1: CGPoint(x: 32.16, y: 9.21), controlPoint2: CGPoint(x: 33.12, y: 7.81))
+ bezierPath.addCurve(to: CGPoint(x: 38.02, y: 10.77), controlPoint1: CGPoint(x: 37.08, y: 7.81), controlPoint2: CGPoint(x: 38.02, y: 9.21))
+ bezierPath.addLine(to: CGPoint(x: 38.02, y: 39.04))
+ bezierPath.addCurve(to: CGPoint(x: 39.25, y: 43.73), controlPoint1: CGPoint(x: 38.02, y: 42.09), controlPoint2: CGPoint(x: 38.34, y: 43.73))
+ bezierPath.addCurve(to: CGPoint(x: 44.46, y: 33.74), controlPoint1: CGPoint(x: 40.83, y: 43.73), controlPoint2: CGPoint(x: 42.82, y: 37.22))
+ bezierPath.addCurve(to: CGPoint(x: 49.41, y: 29.43), controlPoint1: CGPoint(x: 45.93, y: 30.57), controlPoint2: CGPoint(x: 46.89, y: 29.43))
+ bezierPath.addCurve(to: CGPoint(x: 52.2, y: 31.8), controlPoint1: CGPoint(x: 50.53, y: 29.43), controlPoint2: CGPoint(x: 52.2, y: 30.54))
+ bezierPath.addCurve(to: CGPoint(x: 49.65, y: 40.39), controlPoint1: CGPoint(x: 52.2, y: 33.77), controlPoint2: CGPoint(x: 50.56, y: 37.46))
+ bezierPath.addLine(to: CGPoint(x: 49.52, y: 40.81))
+ bezierPath.addCurve(to: CGPoint(x: 40.74, y: 59.66), controlPoint1: CGPoint(x: 48.39, y: 44.73), controlPoint2: CGPoint(x: 46.39, y: 53.71))
+ bezierPath.addCurve(to: CGPoint(x: 24.16, y: 66.46), controlPoint1: CGPoint(x: 36.52, y: 64.12), controlPoint2: CGPoint(x: 31.25, y: 66.46))
+ bezierPath.addCurve(to: CGPoint(x: 5, y: 45.54), controlPoint1: CGPoint(x: 13, y: 66.46), controlPoint2: CGPoint(x: 5, y: 59.99))
+ bezierPath.close()
+ fillColor.setFill()
+ bezierPath.fill()
+ context.restoreGState()
+ }
+
+ @objc(StyleKitNameResizingBehavior)
+ public enum ResizingBehavior: Int {
+
+ case aspectFit
+ case aspectFill
+ case stretch
+ case center
+
+ public func apply(rect: CGRect, target: CGRect) -> CGRect {
+ if rect == target || target == CGRect.zero {
+ return rect
+ }
+
+ var scales = CGSize.zero
+ scales.width = abs(target.width / rect.width)
+ scales.height = abs(target.height / rect.height)
+
+ switch self {
+ case .aspectFit:
+ scales.width = min(scales.width, scales.height)
+ scales.height = scales.width
+ case .aspectFill:
+ scales.width = max(scales.width, scales.height)
+ scales.height = scales.width
+ case .stretch:
+ break
+ case .center:
+ scales.width = 1
+ scales.height = 1
+ }
+
+ var result = rect.standardized
+ result.size.width *= scales.width
+ result.size.height *= scales.height
+ result.origin.x = target.minX + (target.width - result.width) / 2
+ result.origin.y = target.minY + (target.height - result.height) / 2
+ return result
+ }
+ }
+ }
+}