Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | // |
2 | // General.swift |
||
3 | // Subspedia |
||
4 | // |
||
5 | // Created by Matteo Riva on 16/07/15. |
||
6 | // Copyright (c) 2015 Matteo Riva. All rights reserved. |
||
7 | // |
||
8 | |||
9 | import UIKit |
||
10 | |||
11 | struct ScreenSize { |
||
12 | static let SCREEN_WIDTH = UIScreen.main.bounds.size.width |
||
13 | static let SCREEN_HEIGHT = UIScreen.main.bounds.size.height |
||
14 | static let SCREEN_MAX_LENGTH = max(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT) |
||
15 | static let SCREEN_MIN_LENGTH = min(ScreenSize.SCREEN_WIDTH, ScreenSize.SCREEN_HEIGHT) |
||
16 | } |
||
17 | |||
18 | extension Int16 { |
||
19 | func format(_ f: String) -> String { |
||
20 | return String(format: "%\(f)d", self) |
||
21 | } |
||
22 | } |
||
23 | |||
24 | extension Int { |
||
25 | func format(_ f: String) -> String { |
||
26 | return String(format: "%\(f)d", self) |
||
27 | } |
||
28 | } |
||
29 | |||
30 | extension String { |
||
31 | var localized: String { |
||
32 | return NSLocalizedString(self, tableName: nil, bundle: Bundle.main, value: "", comment: "") |
||
33 | } |
||
34 | } |