Skip to content

Commit 6df9fc3

Browse files
authored
Update README
1 parent 26397a0 commit 6df9fc3

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

README.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ Using `NSIcon` is as simple as the built-in `Image` view in SwiftUI.
1818
You can get access to almost any app icon installed on your Mac.
1919

2020
```swift
21-
NSIcon() // Use the parameterless initializer if you want to access the icon of your app itself.
22-
NSIcon("Safari") // Get Safari app icon.
23-
NSIcon(bundleIdentifier: "com.apple.safari") // You can also access app icon through the App's Bundle Identifier.
21+
// Use the parameterless initializer if you want to access the icon of your app itself.
22+
NSIcon()
23+
24+
// Get an app icon view by name.
25+
NSIcon("Safari")
26+
27+
// You can also access app icon by its bundle identifier.
28+
NSIcon(bundleIdentifier: "com.apple.safari")
2429
```
2530

2631
If the corresponding icon cannot be provided, NSIcon displays the GenericApplicationIcon that comes with macOS by default.
@@ -30,6 +35,19 @@ If the corresponding icon cannot be provided, NSIcon displays the GenericApplica
3035
alt="GenericApplicationIcon" width="128"/>
3136
</p>
3237

38+
You can use `iconPlaceholderStyle` modifier to get a different appearance of the placeholder.
39+
40+
```swift
41+
NSIcon("unknown")
42+
.iconPlaceholderStyle(.classic)
43+
```
44+
45+
<p align="center">
46+
<img src="https://github.com/Stv-X/NSIcon/assets/30586070/56374d34-cd6b-48fc-9b1f-c005be6dea3d"
47+
alt="GenericApplicationIconClassic" width="128"/>
48+
</p>
49+
50+
3351
### NSAsyncIcon
3452
`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).
3553

@@ -50,6 +68,8 @@ iOS app icons and a few of macOS app icons present in a opaque square shape. The
5068
NSAsyncIcon("Pages", for: .iOS, addMask: true)
5169
```
5270

71+
![NSAsyncIconPreview](https://github.com/Stv-X/NSIcon/assets/30586070/a24cb2b5-e54e-4e28-a1e5-798c5d03cc30)
72+
5373
> Note: The iOS app icons appear slightly larger than Mac app icons, as determined by Apple's [Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/app-icons). This framework does not intend to undermine these rules. Please handle it according to your specific use case as needed.
5474
5575
Sometimes, you may want to access certain apps that are only available in specific countries or regions' App Store. You can easily achieve this by inputting a country code.
@@ -58,6 +78,8 @@ Sometimes, you may want to access certain apps that are only available in specif
5878
NSAsyncIcon("原神", country: "CN")
5979
```
6080

81+
![NSAsyncIconCountryPreview](https://github.com/Stv-X/NSIcon/assets/30586070/b88c6e18-8907-4be5-b855-0584c1d8eaf2)
82+
6183
## Installation
6284

6385
NSIcon is available with Swift Package Manager.

0 commit comments

Comments
 (0)