@@ -2,7 +2,16 @@ import SwiftUI
22import AppIconCreator
33
44public struct ExampleAppIconView : View {
5- public init ( ) { }
5+ public enum Platform {
6+ case iOS
7+ case macOS
8+ }
9+
10+ public init ( _ platform: Platform ) {
11+ self . platform = platform
12+ }
13+
14+ var platform : Platform
615
716 public var body : some View {
817 GeometryReader { geometry in
@@ -15,16 +24,44 @@ public struct ExampleAppIconView: View {
1524 startPoint: . top,
1625 endPoint: . bottom
1726 ) )
18- . padding ( geometry. size. width * 0.15 )
27+ . padding ( geometry. size. width * 0.18 )
1928 . frame ( maxWidth: . infinity, maxHeight: . infinity)
29+ . background (
30+ LinearGradient (
31+ gradient: Gradient ( colors: [ . blue, . purple] ) ,
32+ startPoint: . top,
33+ endPoint: . bottom
34+ )
35+ )
36+ . if ( platform == . macOS) {
37+ $0. overlay (
38+ RoundedRectangle (
39+ cornerRadius: geometry. size. width * 0.4 ,
40+ style: . continuous
41+ )
42+ . strokeBorder (
43+ lineWidth: geometry. size. width * 0.06
44+ )
45+ . overlayMask (
46+ LinearGradient (
47+ gradient: Gradient ( colors: [ . purple, . blue] ) ,
48+ startPoint: . top,
49+ endPoint: . bottom
50+ )
51+ )
52+ . shadow (
53+ color: Color . black. opacity ( 0.5 ) ,
54+ radius: geometry. size. width * 0.015
55+ )
56+ )
57+ . clipShape (
58+ RoundedRectangle (
59+ cornerRadius: geometry. size. width * 0.4 ,
60+ style: . continuous
61+ )
62+ )
63+ }
2064 }
21- . background (
22- LinearGradient (
23- gradient: Gradient ( colors: [ . blue, . purple] ) ,
24- startPoint: . top,
25- endPoint: . bottom
26- )
27- )
2865 }
2966}
3067
@@ -37,8 +74,13 @@ extension View {
3774struct ExampleAppIconView_Preivews : PreviewProvider {
3875 static var previews : some View {
3976 IconPreviews (
40- icon: ExampleAppIconView ( ) ,
77+ icon: ExampleAppIconView ( . iOS ) ,
4178 configs: . iOS
4279 )
80+ IconPreviews (
81+ icon: ExampleAppIconView ( . macOS) ,
82+ configs: . macOS,
83+ clip: false
84+ )
4385 }
4486}
0 commit comments