OLD | NEW |
1 // | 1 // |
2 // FavIcon | 2 // FavIcon |
3 // Copyright © 2016 Leon Breedt | 3 // Copyright © 2016 Leon Breedt |
4 // | 4 // |
5 // Licensed under the Apache License, Version 2.0 (the "License"); | 5 // Licensed under the Apache License, Version 2.0 (the "License"); |
6 // you may not use this file except in compliance with the License. | 6 // you may not use this file except in compliance with the License. |
7 // You may obtain a copy of the License at | 7 // You may obtain a copy of the License at |
8 // | 8 // |
9 // http://www.apache.org/licenses/LICENSE-2.0 | 9 // http://www.apache.org/licenses/LICENSE-2.0 |
10 // | 10 // |
11 // Unless required by applicable law or agreed to in writing, software | 11 // Unless required by applicable law or agreed to in writing, software |
12 // distributed under the License is distributed on an "AS IS" BASIS, | 12 // distributed under the License is distributed on an "AS IS" BASIS, |
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 // See the License for the specific language governing permissions and | 14 // See the License for the specific language governing permissions and |
15 // limitations under the License. | 15 // limitations under the License. |
16 // | 16 // |
17 | 17 |
18 /// Enumerates the types of detected icons. | 18 /// Enumerates the types of detected icons. |
19 @objc public enum DetectedIconType: UInt { | 19 @objc |
| 20 public enum DetectedIconType: UInt { |
20 /// A shortcut icon. | 21 /// A shortcut icon. |
21 case shortcut | 22 case shortcut |
22 /// A classic icon (usually in the range 16x16 to 48x48). | 23 /// A classic icon (usually in the range 16x16 to 48x48). |
23 case classic | 24 case classic |
24 /// A Google TV icon. | 25 /// A Google TV icon. |
25 case googleTV | 26 case googleTV |
26 /// An icon used by Chrome/Android. | 27 /// An icon used by Chrome/Android. |
27 case googleAndroidChrome | 28 case googleAndroidChrome |
28 /// An icon used by Safari on OS X for tabs. | 29 /// An icon used by Safari on OS X for tabs. |
29 case appleOSXSafariTab | 30 case appleOSXSafariTab |
30 /// An icon used iOS for Web Clips on home screen. | 31 /// An icon used iOS for Web Clips on home screen. |
31 case appleIOSWebClip | 32 case appleIOSWebClip |
32 /// An icon used for a pinned site in Windows. | 33 /// An icon used for a pinned site in Windows. |
33 case microsoftPinnedSite | 34 case microsoftPinnedSite |
34 /// An icon defined in a Web Application Manifest JSON file, mainly Android/
Chrome. | 35 /// An icon defined in a Web Application Manifest JSON file, mainly Android/
Chrome. |
35 case webAppManifest | 36 case webAppManifest |
36 /// A website image that is used for Facebook display purposes | 37 /// A website image that is used for Facebook display purposes |
37 case FBImage | 38 case FBImage |
38 } | 39 } |
39 | 40 |
40 /// Represents a detected icon. | 41 /// Represents a detected icon. |
41 @objc public class DetectedIcon : NSObject { | 42 @objc |
| 43 public class DetectedIcon: NSObject { |
42 /// The absolute URL for the icon file. | 44 /// The absolute URL for the icon file. |
43 @objc public let url: URL | 45 @objc public let url: URL |
44 /// The type of the icon. | 46 /// The type of the icon. |
45 @objc public let type: DetectedIconType | 47 @objc public let type: DetectedIconType |
46 /// The width of the icon, if known, in pixels. | 48 /// The width of the icon, if known, in pixels. |
47 public let width: Int? | 49 public let width: Int? |
48 /// The height of the icon, if known, in pixels. | 50 /// The height of the icon, if known, in pixels. |
49 public let height: Int? | 51 public let height: Int? |
50 | 52 |
51 init(url: URL, type: DetectedIconType, width: Int? = nil, height: Int? = nil
) { | 53 init(url: URL, type: DetectedIconType, width: Int? = nil, height: Int? = nil
) { |
52 self.url = url | 54 self.url = url |
53 self.type = type | 55 self.type = type |
54 self.width = width | 56 self.width = width |
55 self.height = height | 57 self.height = height |
56 } | 58 } |
57 } | 59 } |
OLD | NEW |