OLD | NEW |
1 //: # FavIcon | 1 //: # FavIcon |
2 //: Welcome to the introduction for the FavIcon library. I hope you find it usef
ul and easy to use. | 2 //: Welcome to the introduction for the FavIcon library. I hope you find it usef
ul and easy to use. |
3 //: I'll walk you through the various usage scenarios. | 3 //: I'll walk you through the various usage scenarios. |
4 //: | 4 //: |
5 //: *Important:* You'll need Internet access to get the most out of this playgro
und. | 5 //: *Important:* You'll need Internet access to get the most out of this playgro
und. |
6 //: | 6 //: |
7 //: First, you need to import `FavIcon` to pull in the library into the current
file. | 7 //: First, you need to import `FavIcon` to pull in the library into the current
file. |
8 import FavIcon | 8 import FavIcon |
9 //: We'll use `downloadPreferred(url:width:height:completion:)` first, which tri
es to download the "best" icon. | 9 //: We'll use `downloadPreferred(url:width:height:completion:)` first, which tri
es to download the "best" icon. |
10 //: If you know the size you want, you can provide values for the optional `widt
h` and `height` parameters, | 10 //: If you know the size you want, you can provide values for the optional `widt
h` and `height` parameters, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 //: If one is to your liking, you can download it using `download(url:completion
:)`. | 49 //: If one is to your liking, you can download it using `download(url:completion
:)`. |
50 FavIcon.download([icon]) { results in | 50 FavIcon.download([icon]) { results in |
51 for result in results { | 51 for result in results { |
52 if case let .success(image) = result { | 52 if case let .success(image) = result { |
53 let icon = image | 53 let icon = image |
54 } | 54 } |
55 } | 55 } |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | |
60 | |
61 | |
62 | |
63 //: That's it. Good luck, have fun! | 59 //: That's it. Good luck, have fun! |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | |
78 //: You don't actually need the next two lines when you're using this library, t
hey're just here so | 60 //: You don't actually need the next two lines when you're using this library, t
hey're just here so |
79 //: that network requests get a chance to execute when inside a playground. | 61 //: that network requests get a chance to execute when inside a playground. |
80 import PlaygroundSupport | 62 import PlaygroundSupport |
81 PlaygroundPage.current.needsIndefiniteExecution = true | 63 PlaygroundPage.current.needsIndefiniteExecution = true |
OLD | NEW |