diff --git a/Assets/Icons.sketch b/Assets/Icons.sketch index 4a8dbc7..9424eeb 100644 Binary files a/Assets/Icons.sketch and b/Assets/Icons.sketch differ diff --git a/Example-Old/Example/AppDelegate.swift b/Example-Old/Example/AppDelegate.swift index f5ecd4f..c128af9 100644 --- a/Example-Old/Example/AppDelegate.swift +++ b/Example-Old/Example/AppDelegate.swift @@ -76,21 +76,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } extension ProHUD.Scene { - static var confirm: ProHUD.Scene { - var scene = ProHUD.Scene(identifier: "confirm") - scene.image = UIImage(named: "ProHUDMessage") - return scene - } + static var delete: ProHUD.Scene { var scene = ProHUD.Scene(identifier: "delete") - scene.image = UIImage(named: "ProHUDTrash") + scene.image = UIImage(named: "prohud.trash") scene.title = "确认删除" scene.message = "此操作不可撤销" return scene } + static var buy: ProHUD.Scene { var scene = ProHUD.Scene(identifier: "buy") - scene.image = UIImage(named: "ProHUDBuy") + scene.image = UIImage(named: "alert.buy") scene.title = "确认付款" scene.message = "一旦购买拒不退款" return scene diff --git a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@2x.png b/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@2x.png deleted file mode 100644 index a9890d7..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@2x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@3x.png b/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@3x.png deleted file mode 100644 index 8fed210..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/矩形@3x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/Contents.json deleted file mode 100644 index d050e76..0000000 --- a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDMessage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDMessage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png b/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png deleted file mode 100644 index 9b5aa6a..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@2x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png b/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png deleted file mode 100644 index a7322dd..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDMessage.imageset/ProHUDMessage@3x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/Contents.json deleted file mode 100644 index f6faed5..0000000 --- a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDTrash@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "ProHUDTrash@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png b/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png deleted file mode 100644 index d136622..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@2x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png b/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png deleted file mode 100644 index d3f1cce..0000000 Binary files a/Example-Old/Example/Assets.xcassets/ProHUDTrash.imageset/ProHUDTrash@3x.png and /dev/null differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/alert.buy.imageset/Contents.json similarity index 100% rename from Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/Contents.json rename to Example-Old/Example/Assets.xcassets/alert.buy.imageset/Contents.json diff --git a/Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/ProHUDBuy@2x.png b/Example-Old/Example/Assets.xcassets/alert.buy.imageset/ProHUDBuy@2x.png similarity index 100% rename from Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/ProHUDBuy@2x.png rename to Example-Old/Example/Assets.xcassets/alert.buy.imageset/ProHUDBuy@2x.png diff --git a/Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/ProHUDBuy@3x.png b/Example-Old/Example/Assets.xcassets/alert.buy.imageset/ProHUDBuy@3x.png similarity index 100% rename from Example-Old/Example/Assets.xcassets/ProHUDBuy.imageset/ProHUDBuy@3x.png rename to Example-Old/Example/Assets.xcassets/alert.buy.imageset/ProHUDBuy@3x.png diff --git a/Example-Old/Example/Assets.xcassets/icon_download.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/Contents.json similarity index 100% rename from Example-Old/Example/Assets.xcassets/icon_download.imageset/Contents.json rename to Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/Contents.json diff --git a/Example-Old/Example/Assets.xcassets/icon_download.imageset/cloud download (2).png b/Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/cloud download (2).png similarity index 100% rename from Example-Old/Example/Assets.xcassets/icon_download.imageset/cloud download (2).png rename to Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/cloud download (2).png diff --git a/Example-Old/Example/Assets.xcassets/icon_download.imageset/cloud download (3).png b/Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/cloud download (3).png similarity index 100% rename from Example-Old/Example/Assets.xcassets/icon_download.imageset/cloud download (3).png rename to Example-Old/Example/Assets.xcassets/icloud.and.arrow.down.imageset/cloud download (3).png diff --git a/Source/ProHUD.xcassets/prohud.error.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/Contents.json similarity index 76% rename from Source/ProHUD.xcassets/prohud.error.imageset/Contents.json rename to Example-Old/Example/Assets.xcassets/prohud.candy.imageset/Contents.json index c6fbfc7..a26cc9e 100644 --- a/Source/ProHUD.xcassets/prohud.error.imageset/Contents.json +++ b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "fail@2x.png", + "filename" : "prohud.candy@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "fail@3x.png", + "filename" : "prohud.candy@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@2x.png b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@2x.png new file mode 100644 index 0000000..5aaa172 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@3x.png b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@3x.png new file mode 100644 index 0000000..d73fcd4 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.candy.imageset/prohud.candy@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/Contents.json new file mode 100644 index 0000000..584ff70 --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.checkmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.checkmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png new file mode 100644 index 0000000..0fecb2b Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png new file mode 100644 index 0000000..9f75dfc Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/Contents.json new file mode 100644 index 0000000..b7d3d0a --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.exclamationmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.exclamationmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png new file mode 100644 index 0000000..9d508b3 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png new file mode 100644 index 0000000..ffa30f1 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.message.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/Contents.json new file mode 100644 index 0000000..0219061 --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.message@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.message@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@2x.png b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@2x.png new file mode 100644 index 0000000..6d256b6 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@3x.png b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@3x.png new file mode 100644 index 0000000..c37d8b0 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.message.imageset/prohud.message@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/Contents.json similarity index 76% rename from Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/Contents.json rename to Example-Old/Example/Assets.xcassets/prohud.note.imageset/Contents.json index 61d30f6..91ca9d0 100644 --- a/Example-Old/Example/Assets.xcassets/ProHUDLoading1.imageset/Contents.json +++ b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "矩形@2x.png", + "filename" : "prohud.note@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "矩形@3x.png", + "filename" : "prohud.note@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@2x.png b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@2x.png new file mode 100644 index 0000000..44c986e Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@3x.png b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@3x.png new file mode 100644 index 0000000..b7e326f Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.note.imageset/prohud.note@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/Contents.json new file mode 100644 index 0000000..ebaf379 --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.privacy@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.privacy@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png new file mode 100644 index 0000000..cbd1022 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png new file mode 100644 index 0000000..1b42f67 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/Contents.json new file mode 100644 index 0000000..ae5d524 --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.questionmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.questionmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png new file mode 100644 index 0000000..dfd59f5 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png new file mode 100644 index 0000000..8154a9f Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.success.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/Contents.json similarity index 76% rename from Source/ProHUD.xcassets/prohud.success.imageset/Contents.json rename to Example-Old/Example/Assets.xcassets/prohud.trash.imageset/Contents.json index 01a29e9..551989a 100644 --- a/Source/ProHUD.xcassets/prohud.success.imageset/Contents.json +++ b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "success@2x.png", + "filename" : "prohud.trash@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "success@3x.png", + "filename" : "prohud.trash@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@2x.png b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@2x.png new file mode 100644 index 0000000..25fb085 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@3x.png b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@3x.png new file mode 100644 index 0000000..1411e5e Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.trash.imageset/prohud.trash@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/Contents.json new file mode 100644 index 0000000..b9c979b --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.windmill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.windmill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png new file mode 100644 index 0000000..0d0f0d5 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png new file mode 100644 index 0000000..d42e6cd Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/Contents.json b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/Contents.json new file mode 100644 index 0000000..2797b4b --- /dev/null +++ b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.xmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.xmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png new file mode 100644 index 0000000..ed77e18 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png differ diff --git a/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png new file mode 100644 index 0000000..448d1d0 Binary files /dev/null and b/Example-Old/Example/Assets.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png differ diff --git a/Example-Old/Example/Base.lproj/Main.storyboard b/Example-Old/Example/Base.lproj/Main.storyboard index 0d51b02..bf313f0 100644 --- a/Example-Old/Example/Base.lproj/Main.storyboard +++ b/Example-Old/Example/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -11,10 +11,17 @@ - + + + + @@ -43,4 +50,7 @@ + + + diff --git a/Example-Old/Example/TestAlertVC.swift b/Example-Old/Example/TestAlertVC.swift index 6a87bfa..3450860 100644 --- a/Example-Old/Example/TestAlertVC.swift +++ b/Example-Old/Example/TestAlertVC.swift @@ -23,7 +23,7 @@ class TestAlertVC: BaseListVC { "场景:同步成功(写法2)", "场景:同步失败和重试", "极端场景:短时间内调用了多次同一个弹窗", - "极端场景:多个弹窗重叠", + "极端场景:多个不同的弹窗重叠", "测试较长的标题和内容", "测试特别长的标题和内容"] } @@ -45,10 +45,8 @@ class TestAlertVC: BaseListVC { t?.pop() f() } - self?.simulateSync() } } - simulateSync() } f() } else if row == 1 { diff --git a/Example-Old/Example/TestGuardVC.swift b/Example-Old/Example/TestGuardVC.swift index f63b604..ccd08f1 100644 --- a/Example-Old/Example/TestGuardVC.swift +++ b/Example-Old/Example/TestGuardVC.swift @@ -29,7 +29,7 @@ class TestGuardVC: BaseListVC { Guard.push() { (vc) in vc.update { (vm) in vm.add(action: .destructive, title: "删除") { [weak vc] in - Alert.push(scene: .delete, title: "确认删除", message: "此操作不可撤销") { (vc) in + Alert.push(scene: .delete) { (vc) in vc.update { (vm) in vm.add(action: .destructive, title: "删除") { [weak vc] in vc?.pop() diff --git a/Example-Old/Example/TestToastVC.swift b/Example-Old/Example/TestToastVC.swift index 7a3a91d..5a78a12 100644 --- a/Example-Old/Example/TestToastVC.swift +++ b/Example-Old/Example/TestToastVC.swift @@ -29,6 +29,7 @@ class TestToastVC: BaseListVC { "根据id查找并修改实例", "测试较长的标题和内容", "测试特别长的标题和内容", + "测试只有title", "测试只有message"] } @@ -62,7 +63,12 @@ class TestToastVC: BaseListVC { } else if row == 4 { Toast.push(scene: .default, title: "传入指定图标测试", message: "这是消息内容") { (vc) in vc.update { (vm) in - vm.icon = UIImage(named: "icon_download") + if #available(iOS 13.0, *) { + vc.imageView.tintColor = .brown + vm.icon = UIImage(systemName: "icloud.and.arrow.down") + } else { + vm.icon = UIImage(named: "icloud.and.arrow.down") + } } } } else if row == 5 { @@ -73,7 +79,7 @@ class TestToastVC: BaseListVC { } } } else if row == 6 { - Toast.push(scene: .default, title: "好友邀请", message: "你收到一条好友邀请,点击查看详情。", duration: 10) { (vc) in + Toast.push(scene: .message, title: "好友邀请", message: "你收到一条好友邀请,点击查看详情。", duration: 10) { (vc) in vc.identifier = "xxx" vc.didTapped { [weak vc] in vc?.pop() @@ -117,7 +123,6 @@ class TestToastVC: BaseListVC { } else if row == 9 { Toast.push() { (a) in a.update { (vm) in - vm.scene = .warning vm.title = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" vm.message = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" @@ -126,7 +131,6 @@ class TestToastVC: BaseListVC { } else if row == 10 { Toast.push() { (a) in a.update { (vm) in - vm.scene = .warning vm.title = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" vm.message = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" @@ -136,15 +140,23 @@ class TestToastVC: BaseListVC { Toast.push() { (a) in a.update { (vm) in vm.scene = .warning - vm.message = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" + vm.title = "正在同步看到了你撒地" } } - } + } else if row == 12 { + Toast.push() { (a) in + a.update { (vm) in + vm.scene = .warning + vm.message = "正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过正在同步看到了你撒地方快乐撒的肌肤轮廓啊就是;来的跨省的人格人格离开那地方离开过" + + } + } + } } func simulateSync() { - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { + DispatchQueue.main.asyncAfter(deadline: .now() + 10) { Toast.find("loading", last: { (t) in t.update { (vm) in vm.scene = .success diff --git a/Source/Alert/AlertConfig.swift b/Source/Alert/AlertConfig.swift index fd1390b..efc3f6c 100644 --- a/Source/Alert/AlertConfig.swift +++ b/Source/Alert/AlertConfig.swift @@ -10,6 +10,10 @@ import UIKit import SnapKit import Inspire +public extension UIWindow.Level { + static let proAlert = UIWindow.Level.alert - 1 +} + public extension ProHUD.Configuration { struct Alert { // MARK: 卡片样式 @@ -112,23 +116,20 @@ fileprivate var privUpdateImage: (ProHUD.Alert) -> Void = { return { (vc) in let config = cfg.alert let img = vc.vm.icon ?? vc.vm.scene.image - if let imgv = vc.imageView { - imgv.image = img - } else { - let icon = UIImageView(image: img) - vc.contentStack.addArrangedSubview(icon) - icon.contentMode = .scaleAspectFit - icon.snp.makeConstraints { (mk) in - mk.top.greaterThanOrEqualTo(vc.contentView).offset(config.padding*2.25) - mk.bottom.lessThanOrEqualTo(vc.contentView).offset(-config.padding*2.25) - mk.leading.greaterThanOrEqualTo(vc.contentView).offset(config.padding*4) - mk.trailing.lessThanOrEqualTo(vc.contentView).offset(-config.padding*4) - mk.width.equalTo(config.iconSize.width) - mk.height.equalTo(config.iconSize.height) - } - vc.imageView = icon + vc.imageView.image = img + vc.contentStack.addArrangedSubview(vc.imageView) + vc.imageView.contentMode = .scaleAspectFit + vc.imageView.snp.makeConstraints { (mk) in + mk.top.greaterThanOrEqualTo(vc.contentView).offset(config.padding*2.25) + mk.bottom.lessThanOrEqualTo(vc.contentView).offset(-config.padding*2.25) + mk.leading.greaterThanOrEqualTo(vc.contentView).offset(config.padding*4) + mk.trailing.lessThanOrEqualTo(vc.contentView).offset(-config.padding*4) + mk.width.equalTo(config.iconSize.width) + mk.height.equalTo(config.iconSize.height) } - vc.imageView?.layer.removeAllAnimations() + vc.imageView.layer.removeAllAnimations() + vc.animateLayer = nil + vc.animation = nil } }() @@ -298,10 +299,10 @@ fileprivate var privReloadData: (ProHUD.Alert) -> Void = { // 动画 if isFirstLayout { vc.view.layoutIfNeeded() - vc.imageView?.transform = .init(scaleX: 0.75, y: 0.75) + vc.imageView.transform = .init(scaleX: 0.75, y: 0.75) UIView.animateForAlert { vc.view.layoutIfNeeded() - vc.imageView?.transform = .identity + vc.imageView.transform = .identity } } else { UIView.animateForAlert { diff --git a/Source/Alert/AlertController.swift b/Source/Alert/AlertController.swift index 35fd21d..efe0434 100644 --- a/Source/Alert/AlertController.swift +++ b/Source/Alert/AlertController.swift @@ -36,7 +36,7 @@ public extension ProHUD { }() /// 图片 - public var imageView: UIImageView? + public var imageView = UIImageView() /// 标题 public var titleLabel: UILabel? @@ -151,16 +151,11 @@ public extension Alert { vm.forceQuitCallback = callback } - - /// 图片旋转效果 - /// - Parameter flag: 是否开启 - func rotate(_ flag: Bool = true, direction: ProHUD.RotateDirection = .clockwise, speed: CFTimeInterval = 1) { - DispatchQueue.main.async { - self.imageView?.rotate(flag: flag, direction: direction, speed: speed) - } - } } +extension Alert: RotateAnimation { + +} // MARK: - 实例管理器 public extension Alert { @@ -320,7 +315,7 @@ fileprivate extension Alert { alertWindow = w w.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0) // 比原生alert层级低一点 - w.windowLevel = UIWindow.Level.alert - 1 + w.windowLevel = .proAlert return w } @@ -337,7 +332,7 @@ fileprivate extension Alert { } else if alerts.count == 1 { alerts.removeAll() } else { - debug("漏洞:已经没有alert了") + debug("‼️代码漏洞:已经没有alert了") } } diff --git a/Source/Alert/AlertModel.swift b/Source/Alert/AlertModel.swift index 9c5d679..d262c4c 100644 --- a/Source/Alert/AlertModel.swift +++ b/Source/Alert/AlertModel.swift @@ -31,7 +31,7 @@ public extension Alert { /// 图标 public var icon: UIImage? { didSet { - vc?.imageView?.image = icon + vc?.imageView.image = icon } } diff --git a/Source/Guard/GuardController.swift b/Source/Guard/GuardController.swift index ff0bff5..98ed95a 100644 --- a/Source/Guard/GuardController.swift +++ b/Source/Guard/GuardController.swift @@ -120,9 +120,9 @@ public extension Guard { return f(vc) } else { // 尝试获取RootVC - let ws = UIApplication.shared.windows.reversed().filter { (w) -> Bool in + let ws = UIApplication.shared.windows.filter { (w) -> Bool in // 去除掉诸如 UITextEffectsWindow 这样的类,去掉隐藏的Window - if "\(type(of:w))" == "UIWindow" && w.isHidden == false { + if "\(type(of:w))" == "UIWindow" && w.isHidden == false && w.windowLevel == .normal { return true } else { return false diff --git a/Source/HUDController.swift b/Source/HUDController.swift index 48d601d..2819f19 100644 --- a/Source/HUDController.swift +++ b/Source/HUDController.swift @@ -17,6 +17,10 @@ public class HUDController: UIViewController { internal var didAppearCallback: (() -> Void)? internal var willDisappearCallback: (() -> Void)? internal var didDisappearCallback: (() -> Void)? + + /// 执行动画的图层 + public var animateLayer: CALayer? + internal var animation: CAAnimation? /// 按钮事件 internal var buttonEvents = [UIButton:() -> Void]() @@ -84,3 +88,50 @@ internal extension HUDController { } } + +extension HUDController { + @objc func pauseAnimation() { + if let layer = animateLayer { + animation = layer.animation(forKey: .rotateKey) + layer.timeOffset = layer.convertTime(CACurrentMediaTime(), from: nil) + layer.speed = 0 + } + } + @objc func resumeAnimation() { + if let layer = animateLayer, let ani = animation, layer.speed == 0 { + let pauseTime = layer.timeOffset + layer.timeOffset = 0 + let beginTime = layer.convertTime(CACurrentMediaTime(), from: nil) - pauseTime + layer.beginTime = beginTime + layer.speed = 1 + layer.add(ani, forKey: .rotateKey) + } + } +} + +public protocol RotateAnimation: HUDController { + var imageView: UIImageView { get } + var animateLayer: CALayer? { get set } +} + +public extension RotateAnimation { + + func rotate(_ layer: CALayer? = nil, direction: ProHUD.RotateDirection = .clockwise, speed: CFTimeInterval = 1) { + DispatchQueue.main.async { + let l = layer ?? self.imageView.layer + self.animateLayer = l + l.startRotate(direction: direction, speed: speed) + NotificationCenter.default.addObserver(self, selector: #selector(self.pauseAnimation), name: UIApplication.didEnterBackgroundNotification, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(self.resumeAnimation), name: UIApplication.willEnterForegroundNotification, object: nil) + } + } + func rotate(_ layer: CALayer? = nil, _ flag: Bool) { + DispatchQueue.main.async { + self.animateLayer = nil + (layer ?? self.imageView.layer)?.endRotate() + NotificationCenter.default.removeObserver(self, name: UIApplication.didEnterBackgroundNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIApplication.willEnterForegroundNotification, object: nil) + } + } + +} diff --git a/Source/HUDView.swift b/Source/HUDView.swift index 80548b7..e202501 100644 --- a/Source/HUDView.swift +++ b/Source/HUDView.swift @@ -31,6 +31,11 @@ public extension ProHUD { case clockwise = 1 case counterclockwise = -1 } + +} + +internal extension String { + static let rotateKey = "rotationAnimation" } internal extension Alert { @@ -150,21 +155,21 @@ internal extension UIView { animateForGuard(animations: animations, completion: nil) } - func rotate(flag: Bool, direction: ProHUD.RotateDirection, speed: CFTimeInterval) { - if flag == true { - if layer.animation(forKey: "rotationAnimation") == nil { - let ani = CABasicAnimation(keyPath: "transform.rotation.z") - ani.toValue = direction.rawValue * Double.pi * 2.0 - if speed > 0 { - ani.duration = 2 / speed - } - ani.repeatDuration = .infinity - layer.add(ani, forKey: "rotationAnimation") +} + +extension CALayer { + func startRotate(direction: ProHUD.RotateDirection, speed: CFTimeInterval) { + if animation(forKey: .rotateKey) == nil { + let ani = CABasicAnimation(keyPath: "transform.rotation.z") + ani.toValue = direction.rawValue * Double.pi * 2.0 + if speed > 0 { + ani.duration = 2 / speed } - } else { - layer.removeAnimation(forKey: "rotationAnimation") + ani.repeatDuration = .infinity + add(ani, forKey: .rotateKey) } } - - + func endRotate() { + removeAnimation(forKey: .rotateKey) + } } diff --git a/Source/ProHUD.swift b/Source/ProHUD.swift index c43ef7d..a47a974 100644 --- a/Source/ProHUD.swift +++ b/Source/ProHUD.swift @@ -33,15 +33,19 @@ public class ProHUD { } -// 默认场景 +// 默认场景,可直接在项目工程中覆写场景参数 public extension ProHUD.Scene { init(identifier: String) { self.init() id = identifier } - static var `default`: ProHUD.Scene { var scene = ProHUD.Scene.init(identifier: "default") + scene.image = ProHUD.image(named: "prohud.note") + return scene + } + static var message: ProHUD.Scene { + var scene = ProHUD.Scene.init(identifier: "message") scene.image = ProHUD.image(named: "prohud.message") return scene } @@ -49,27 +53,48 @@ public extension ProHUD.Scene { var scene = ProHUD.Scene.init(identifier: "loading") scene.alertDuration = 0 scene.toastDuration = 0 - scene.image = ProHUD.image(named: "prohud.loading") + scene.image = ProHUD.image(named: "prohud.candy") return scene } static var success: ProHUD.Scene { var scene = ProHUD.Scene.init(identifier: "success") scene.alertDuration = 2 - scene.image = ProHUD.image(named: "prohud.success") + scene.image = ProHUD.image(named: "prohud.checkmark") return scene } static var warning: ProHUD.Scene { var scene = ProHUD.Scene.init(identifier: "warning") scene.alertDuration = 2 scene.toastDuration = 5 - scene.image = ProHUD.image(named: "prohud.warning") + scene.image = ProHUD.image(named: "prohud.exclamationmark") return scene } static var error: ProHUD.Scene { var scene = ProHUD.Scene.init(identifier: "error") scene.alertDuration = 2 scene.toastDuration = 5 - scene.image = ProHUD.image(named: "prohud.error") + scene.image = ProHUD.image(named: "prohud.xmark") + return scene + } + static var confirm: ProHUD.Scene { + var scene = ProHUD.Scene.init(identifier: "confirm") + scene.alertDuration = 2 + scene.toastDuration = 5 + scene.image = ProHUD.image(named: "prohud.questionmark") + return scene + } + static var privacy: ProHUD.Scene { + var scene = ProHUD.Scene.init(identifier: "privacy") + scene.alertDuration = 2 + scene.toastDuration = 5 + scene.image = ProHUD.image(named: "prohud.privacy") + return scene + } + static var delete: ProHUD.Scene { + var scene = ProHUD.Scene.init(identifier: "delete") + scene.alertDuration = 2 + scene.toastDuration = 5 + scene.image = ProHUD.image(named: "prohud.trash") return scene } diff --git a/Source/ProHUD.xcassets/prohud.candy.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.candy.imageset/Contents.json new file mode 100644 index 0000000..a26cc9e --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.candy.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.candy@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.candy@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@2x.png b/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@2x.png new file mode 100644 index 0000000..5aaa172 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@3x.png b/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@3x.png new file mode 100644 index 0000000..d73fcd4 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.candy.imageset/prohud.candy@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.checkmark.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.checkmark.imageset/Contents.json new file mode 100644 index 0000000..584ff70 --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.checkmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.checkmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.checkmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png b/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png new file mode 100644 index 0000000..0fecb2b Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png b/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png new file mode 100644 index 0000000..9f75dfc Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.checkmark.imageset/prohud.checkmark@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.error.imageset/fail@2x.png b/Source/ProHUD.xcassets/prohud.error.imageset/fail@2x.png deleted file mode 100644 index 5918b6b..0000000 Binary files a/Source/ProHUD.xcassets/prohud.error.imageset/fail@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.error.imageset/fail@3x.png b/Source/ProHUD.xcassets/prohud.error.imageset/fail@3x.png deleted file mode 100644 index 490bc00..0000000 Binary files a/Source/ProHUD.xcassets/prohud.error.imageset/fail@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/Contents.json new file mode 100644 index 0000000..b7d3d0a --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.exclamationmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.exclamationmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png new file mode 100644 index 0000000..58c2599 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png new file mode 100644 index 0000000..7b0f441 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.exclamationmark.imageset/prohud.exclamationmark@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.loading.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.loading.imageset/Contents.json deleted file mode 100644 index cbb01e1..0000000 --- a/Source/ProHUD.xcassets/prohud.loading.imageset/Contents.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "loading@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "loading_dark@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "loading@3x.png", - "idiom" : "universal", - "scale" : "3x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "loading_dark@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Source/ProHUD.xcassets/prohud.loading.imageset/loading@2x.png b/Source/ProHUD.xcassets/prohud.loading.imageset/loading@2x.png deleted file mode 100644 index a0974f4..0000000 Binary files a/Source/ProHUD.xcassets/prohud.loading.imageset/loading@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.loading.imageset/loading@3x.png b/Source/ProHUD.xcassets/prohud.loading.imageset/loading@3x.png deleted file mode 100644 index d53953a..0000000 Binary files a/Source/ProHUD.xcassets/prohud.loading.imageset/loading@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@2x.png b/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@2x.png deleted file mode 100644 index 6cf77b8..0000000 Binary files a/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@3x.png b/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@3x.png deleted file mode 100644 index e696a8b..0000000 Binary files a/Source/ProHUD.xcassets/prohud.loading.imageset/loading_dark@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.message.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.message.imageset/Contents.json index d050e76..0219061 100644 --- a/Source/ProHUD.xcassets/prohud.message.imageset/Contents.json +++ b/Source/ProHUD.xcassets/prohud.message.imageset/Contents.json @@ -5,18 +5,18 @@ "scale" : "1x" }, { + "filename" : "prohud.message@2x.png", "idiom" : "universal", - "filename" : "ProHUDMessage@2x.png", "scale" : "2x" }, { + "filename" : "prohud.message@3x.png", "idiom" : "universal", - "filename" : "ProHUDMessage@3x.png", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@2x.png b/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@2x.png deleted file mode 100644 index 9b5aa6a..0000000 Binary files a/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@3x.png b/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@3x.png deleted file mode 100644 index a7322dd..0000000 Binary files a/Source/ProHUD.xcassets/prohud.message.imageset/ProHUDMessage@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@2x.png b/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@2x.png new file mode 100644 index 0000000..6d256b6 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@3x.png b/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@3x.png new file mode 100644 index 0000000..c37d8b0 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.message.imageset/prohud.message@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.warning.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.note.imageset/Contents.json similarity index 76% rename from Source/ProHUD.xcassets/prohud.warning.imageset/Contents.json rename to Source/ProHUD.xcassets/prohud.note.imageset/Contents.json index a0f7a31..91ca9d0 100644 --- a/Source/ProHUD.xcassets/prohud.warning.imageset/Contents.json +++ b/Source/ProHUD.xcassets/prohud.note.imageset/Contents.json @@ -5,12 +5,12 @@ "scale" : "1x" }, { - "filename" : "warning@2x.png", + "filename" : "prohud.note@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "warning@3x.png", + "filename" : "prohud.note@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@2x.png b/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@2x.png new file mode 100644 index 0000000..44c986e Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@3x.png b/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@3x.png new file mode 100644 index 0000000..b7e326f Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.note.imageset/prohud.note@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.privacy.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.privacy.imageset/Contents.json new file mode 100644 index 0000000..ebaf379 --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.privacy.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.privacy@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.privacy@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png b/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png new file mode 100644 index 0000000..3222719 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png b/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png new file mode 100644 index 0000000..90d68e0 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.privacy.imageset/prohud.privacy@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.questionmark.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.questionmark.imageset/Contents.json new file mode 100644 index 0000000..ae5d524 --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.questionmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.questionmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.questionmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png b/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png new file mode 100644 index 0000000..dfd59f5 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png b/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png new file mode 100644 index 0000000..8154a9f Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.questionmark.imageset/prohud.questionmark@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.success.imageset/success@2x.png b/Source/ProHUD.xcassets/prohud.success.imageset/success@2x.png deleted file mode 100644 index 1730567..0000000 Binary files a/Source/ProHUD.xcassets/prohud.success.imageset/success@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.success.imageset/success@3x.png b/Source/ProHUD.xcassets/prohud.success.imageset/success@3x.png deleted file mode 100644 index 72340b0..0000000 Binary files a/Source/ProHUD.xcassets/prohud.success.imageset/success@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.trash.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.trash.imageset/Contents.json new file mode 100644 index 0000000..551989a --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.trash.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.trash@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.trash@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@2x.png b/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@2x.png new file mode 100644 index 0000000..076adfa Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@3x.png b/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@3x.png new file mode 100644 index 0000000..f63d8a2 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.trash.imageset/prohud.trash@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.warning.imageset/warning@2x.png b/Source/ProHUD.xcassets/prohud.warning.imageset/warning@2x.png deleted file mode 100644 index fd95fdc..0000000 Binary files a/Source/ProHUD.xcassets/prohud.warning.imageset/warning@2x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.warning.imageset/warning@3x.png b/Source/ProHUD.xcassets/prohud.warning.imageset/warning@3x.png deleted file mode 100644 index ba5d643..0000000 Binary files a/Source/ProHUD.xcassets/prohud.warning.imageset/warning@3x.png and /dev/null differ diff --git a/Source/ProHUD.xcassets/prohud.windmill.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.windmill.imageset/Contents.json new file mode 100644 index 0000000..b9c979b --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.windmill.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.windmill@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.windmill@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png b/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png new file mode 100644 index 0000000..0d0f0d5 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png b/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png new file mode 100644 index 0000000..d42e6cd Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.windmill.imageset/prohud.windmill@3x.png differ diff --git a/Source/ProHUD.xcassets/prohud.xmark.imageset/Contents.json b/Source/ProHUD.xcassets/prohud.xmark.imageset/Contents.json new file mode 100644 index 0000000..2797b4b --- /dev/null +++ b/Source/ProHUD.xcassets/prohud.xmark.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "prohud.xmark@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "prohud.xmark@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png b/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png new file mode 100644 index 0000000..ed77e18 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@2x.png differ diff --git a/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png b/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png new file mode 100644 index 0000000..448d1d0 Binary files /dev/null and b/Source/ProHUD.xcassets/prohud.xmark.imageset/prohud.xmark@3x.png differ diff --git a/Source/Toast/ToastConfig.swift b/Source/Toast/ToastConfig.swift index 5b9c9f0..b882fba 100644 --- a/Source/Toast/ToastConfig.swift +++ b/Source/Toast/ToastConfig.swift @@ -9,6 +9,10 @@ import UIKit import SnapKit +public extension UIWindow.Level { + static let proToast = UIWindow.Level.alert + 1000 +} + public extension ProHUD.Configuration { struct Toast { // MARK: 卡片样式 @@ -24,7 +28,7 @@ public extension ProHUD.Configuration { public var lineSpace = CGFloat(4) // MARK: 图标样式 /// 图标尺寸 - public var iconSize = CGSize(width: 42, height: 42) + public var iconSize = CGSize(width: 44, height: 44) // MARK: 文本样式 /// 标题字体 @@ -106,17 +110,6 @@ fileprivate var privReloadData: (ProHUD.Toast) -> Void = { mk.trailing.equalToSuperview().offset(-config.padding) mk.bottom.lessThanOrEqualToSuperview().offset(-config.padding) } -// vc.titleLabel.snp.makeConstraints { (mk) in -// mk.top.equalToSuperview().offset(config.padding) -// mk.leading.equalTo(vc.imageView.snp.trailing).offset(config.padding - 4) -// mk.leading.greaterThanOrEqualToSuperview().offset(config.padding) -// mk.trailing.equalToSuperview().offset(-config.padding) -// } -// vc.bodyLabel.snp.makeConstraints { (mk) in -// mk.top.equalTo(vc.titleLabel.snp.bottom).offset(config.lineSpace) -// mk.leading.trailing.equalTo(vc.titleLabel) -// mk.bottom.lessThanOrEqualToSuperview().offset(-config.padding) -// } vc.view.layoutIfNeeded() diff --git a/Source/Toast/ToastController.swift b/Source/Toast/ToastController.swift index 6b9e975..ceeb552 100644 --- a/Source/Toast/ToastController.swift +++ b/Source/Toast/ToastController.swift @@ -124,7 +124,7 @@ public extension Toast { } else { // Fallback on earlier versions } - window.windowLevel = UIWindow.Level(5000) + window.windowLevel = .proToast window.backgroundColor = .clear window.layer.shadowRadius = 8 window.layer.shadowOffset = .init(width: 0, height: 5) @@ -189,14 +189,6 @@ public extension Toast { vm.tapCallback = callback } - /// 图片旋转效果 - /// - Parameter flag: 是否开启 - func rotate(_ flag: Bool = true, direction: ProHUD.RotateDirection = .clockwise, speed: CFTimeInterval = 1) { - DispatchQueue.main.async { - self.imageView.rotate(flag: flag, direction: direction, speed: speed) - } - } - /// 脉冲效果 func pulse() { DispatchQueue.main.async { @@ -214,6 +206,9 @@ public extension Toast { } +extension Toast: RotateAnimation { + +} // MARK: - 实例管理器 public extension Toast { @@ -352,4 +347,3 @@ fileprivate extension Toast { } -