LEFT | RIGHT |
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 // swiftlint:disable file_length | 18 // swiftlint:disable file_length |
19 | 19 |
20 import Foundation | 20 import Foundation |
21 #if os(OSX) | 21 |
| 22 #if os(iOS) |
| 23 import UIKit |
| 24 /// Alias for the iOS image type (`UIImage`). |
| 25 public typealias ImageType = UIImage |
| 26 #elseif os(OSX) |
22 import Cocoa | 27 import Cocoa |
23 /// Alias for the OS X image type (`NSImage`). | 28 /// Alias for the OS X image type (`NSImage`). |
24 public typealias ImageType = NSImage | 29 public typealias ImageType = NSImage |
25 #elseif os(iOS) | |
26 import UIKit | |
27 /// Alias for the iOS image type (`UIImage`). | |
28 public typealias ImageType = UIImage | |
29 #endif | 30 #endif |
30 | 31 |
31 /// Represents the result of attempting to download an icon. | 32 /// Represents the result of attempting to download an icon. |
32 public enum IconDownloadResult { | 33 public enum IconDownloadResult { |
33 | 34 |
34 /// Download successful. | 35 /// Download successful. |
35 /// | 36 /// |
36 /// - parameter image: The `ImageType` for the downloaded icon. | 37 /// - parameter image: The `ImageType` for the downloaded icon. |
37 case success(image: ImageType) | 38 case success(image: ImageType) |
38 | 39 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 401 |
401 extension DetectedIcon { | 402 extension DetectedIcon { |
402 /// The area of a detected icon, if known. | 403 /// The area of a detected icon, if known. |
403 var area: Int? { | 404 var area: Int? { |
404 if let width = width, let height = height { | 405 if let width = width, let height = height { |
405 return width * height | 406 return width * height |
406 } | 407 } |
407 return nil | 408 return nil |
408 } | 409 } |
409 } | 410 } |
LEFT | RIGHT |