You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Available: iOS, iPadOS, Mac Catalyst, watchOS, visionOS
47
+
48
+
Considering the app sandbox environment on these platforms, the icon file assets of other apps are inaccessible, `UIIcon` only provides the ability to access icon of the app itself.
49
+
50
+
Unlike the behavior of `NSIcon`, `UIIcon` adds mask to the icon by default. Use parameter `addMask: Bool` to control.
51
+
52
+
On different platforms, the appearance of masks are different.
| Mask |[AppIconMask](https://github.com/Stv-X/NSIcon/tree/main/Sources/NSIcon/Media.xcassets/AppIconMask.imageset)|[AppIconMask](https://github.com/Stv-X/NSIcon/tree/main/Sources/NSIcon/Media.xcassets/AppIconMask.imageset)|[MacAppIconMask](https://github.com/Stv-X/NSIcon/tree/main/Sources/NSIcon/Media.xcassets/MacAppIconMask.imageset)| Circle | Circle |
57
+
58
+
```swift
59
+
UIIcon()
60
+
UIIcon(addMask: false)
61
+
```
62
+
63
+
In visionOS, the app icon consists of three different layers. Use `init()` to render a merged version by default.
64
+
You can also use `init(_ layer: AppIconlayer)` or `init(_ layers: [AppIconlayer])` to select which parts of the icon to display.
49
65
66
+
```swift
67
+
UIIcon(.back)
68
+
UIIcon([.middle, .front])
69
+
```
70
+
71
+
> Note: `UIIcon` does not support `iconPlaceholderStyle` modifier.
50
72
51
73
### NSAsyncIcon
74
+
#### Available: macOS
75
+
52
76
`NSAsyncIcon` behaves similarly to `NSIcon`, it obtains app icon from the App Store by accessing [iTunes Search API](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/iTuneSearchAPI).
When using `appName` as an initialization parameter, you can set your preferences for iOS app or macOS app to decide the results you receive. The default is `.macOS`.
83
+
When using `appName` as an initialization parameter, you can set your preferences for iOS, macOS, watchOS or visionOS app to decide the results you receive. The default is `.macOS`.
60
84
61
85
```swift
62
86
NSAsyncIcon("Pages", for: .iOS)
63
87
```
64
88
65
89
iOS app icons and a few of macOS app icons present in a opaque square shape. Therefore, consider whether to add a rounded rectangle mask to it. The default is `false`.
66
90
91
+
> Note: `NSAsyncIcon` will check if this icon contains transparent pixels. If so, the mask will not be added to the view.
0 commit comments