-
Notifications
You must be signed in to change notification settings - Fork 0
/
R.generated.swift
275 lines (231 loc) · 9.11 KB
/
R.generated.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
//
// This is a generated file, do not edit!
// Generated by R.swift, see https://github.com/mac-cain13/R.swift
//
import Foundation
import Rswift
import UIKit
/// This `R` struct is generated and contains references to static resources.
struct R: Rswift.Validatable {
fileprivate static let applicationLocale = hostingBundle.preferredLocalizations.first.flatMap { Locale(identifier: $0) } ?? Locale.current
fileprivate static let hostingBundle = Bundle(for: R.Class.self)
/// Find first language and bundle for which the table exists
fileprivate static func localeBundle(tableName: String, preferredLanguages: [String]) -> (Foundation.Locale, Foundation.Bundle)? {
// Filter preferredLanguages to localizations, use first locale
var languages = preferredLanguages
.map { Locale(identifier: $0) }
.prefix(1)
.flatMap { locale -> [String] in
if hostingBundle.localizations.contains(locale.identifier) {
if let language = locale.languageCode, hostingBundle.localizations.contains(language) {
return [locale.identifier, language]
} else {
return [locale.identifier]
}
} else if let language = locale.languageCode, hostingBundle.localizations.contains(language) {
return [language]
} else {
return []
}
}
// If there's no languages, use development language as backstop
if languages.isEmpty {
if let developmentLocalization = hostingBundle.developmentLocalization {
languages = [developmentLocalization]
}
} else {
// Insert Base as second item (between locale identifier and languageCode)
languages.insert("Base", at: 1)
// Add development language as backstop
if let developmentLocalization = hostingBundle.developmentLocalization {
languages.append(developmentLocalization)
}
}
// Find first language for which table exists
// Note: key might not exist in chosen language (in that case, key will be shown)
for language in languages {
if let lproj = hostingBundle.url(forResource: language, withExtension: "lproj"),
let lbundle = Bundle(url: lproj)
{
let strings = lbundle.url(forResource: tableName, withExtension: "strings")
let stringsdict = lbundle.url(forResource: tableName, withExtension: "stringsdict")
if strings != nil || stringsdict != nil {
return (Locale(identifier: language), lbundle)
}
}
}
// If table is available in main bundle, don't look for localized resources
let strings = hostingBundle.url(forResource: tableName, withExtension: "strings", subdirectory: nil, localization: nil)
let stringsdict = hostingBundle.url(forResource: tableName, withExtension: "stringsdict", subdirectory: nil, localization: nil)
if strings != nil || stringsdict != nil {
return (applicationLocale, hostingBundle)
}
// If table is not found for requested languages, key will be shown
return nil
}
/// Load string from Info.plist file
fileprivate static func infoPlistString(path: [String], key: String) -> String? {
var dict = hostingBundle.infoDictionary
for step in path {
guard let obj = dict?[step] as? [String: Any] else { return nil }
dict = obj
}
return dict?[key] as? String
}
static func validate() throws {
try intern.validate()
}
#if os(iOS) || os(tvOS)
/// This `R.storyboard` struct is generated, and contains static references to 2 storyboards.
struct storyboard {
/// Storyboard `LaunchScreen`.
static let launchScreen = _R.storyboard.launchScreen()
/// Storyboard `Main`.
static let main = _R.storyboard.main()
#if os(iOS) || os(tvOS)
/// `UIStoryboard(name: "LaunchScreen", bundle: ...)`
static func launchScreen(_: Void = ()) -> UIKit.UIStoryboard {
return UIKit.UIStoryboard(resource: R.storyboard.launchScreen)
}
#endif
#if os(iOS) || os(tvOS)
/// `UIStoryboard(name: "Main", bundle: ...)`
static func main(_: Void = ()) -> UIKit.UIStoryboard {
return UIKit.UIStoryboard(resource: R.storyboard.main)
}
#endif
fileprivate init() {}
}
#endif
/// This `R.color` struct is generated, and contains static references to 4 colors.
struct color {
/// Color `AccentColor`.
static let accentColor = Rswift.ColorResource(bundle: R.hostingBundle, name: "AccentColor")
/// Color `BlackColor`.
static let blackColor = Rswift.ColorResource(bundle: R.hostingBundle, name: "BlackColor")
/// Color `BlueColor`.
static let blueColor = Rswift.ColorResource(bundle: R.hostingBundle, name: "BlueColor")
/// Color `WhiteColor`.
static let whiteColor = Rswift.ColorResource(bundle: R.hostingBundle, name: "WhiteColor")
#if os(iOS) || os(tvOS)
/// `UIColor(named: "AccentColor", bundle: ..., traitCollection: ...)`
@available(tvOS 11.0, *)
@available(iOS 11.0, *)
static func accentColor(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIColor? {
return UIKit.UIColor(resource: R.color.accentColor, compatibleWith: traitCollection)
}
#endif
#if os(iOS) || os(tvOS)
/// `UIColor(named: "BlackColor", bundle: ..., traitCollection: ...)`
@available(tvOS 11.0, *)
@available(iOS 11.0, *)
static func blackColor(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIColor? {
return UIKit.UIColor(resource: R.color.blackColor, compatibleWith: traitCollection)
}
#endif
#if os(iOS) || os(tvOS)
/// `UIColor(named: "BlueColor", bundle: ..., traitCollection: ...)`
@available(tvOS 11.0, *)
@available(iOS 11.0, *)
static func blueColor(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIColor? {
return UIKit.UIColor(resource: R.color.blueColor, compatibleWith: traitCollection)
}
#endif
#if os(iOS) || os(tvOS)
/// `UIColor(named: "WhiteColor", bundle: ..., traitCollection: ...)`
@available(tvOS 11.0, *)
@available(iOS 11.0, *)
static func whiteColor(compatibleWith traitCollection: UIKit.UITraitCollection? = nil) -> UIKit.UIColor? {
return UIKit.UIColor(resource: R.color.whiteColor, compatibleWith: traitCollection)
}
#endif
#if os(watchOS)
/// `UIColor(named: "AccentColor", bundle: ..., traitCollection: ...)`
@available(watchOSApplicationExtension 4.0, *)
static func accentColor(_: Void = ()) -> UIKit.UIColor? {
return UIKit.UIColor(named: R.color.accentColor.name)
}
#endif
#if os(watchOS)
/// `UIColor(named: "BlackColor", bundle: ..., traitCollection: ...)`
@available(watchOSApplicationExtension 4.0, *)
static func blackColor(_: Void = ()) -> UIKit.UIColor? {
return UIKit.UIColor(named: R.color.blackColor.name)
}
#endif
#if os(watchOS)
/// `UIColor(named: "BlueColor", bundle: ..., traitCollection: ...)`
@available(watchOSApplicationExtension 4.0, *)
static func blueColor(_: Void = ()) -> UIKit.UIColor? {
return UIKit.UIColor(named: R.color.blueColor.name)
}
#endif
#if os(watchOS)
/// `UIColor(named: "WhiteColor", bundle: ..., traitCollection: ...)`
@available(watchOSApplicationExtension 4.0, *)
static func whiteColor(_: Void = ()) -> UIKit.UIColor? {
return UIKit.UIColor(named: R.color.whiteColor.name)
}
#endif
fileprivate init() {}
}
/// This `R.reuseIdentifier` struct is generated, and contains static references to 1 reuse identifiers.
struct reuseIdentifier {
/// Reuse identifier `NewsListingCell`.
static let newsListingCell: Rswift.ReuseIdentifier<NewsListingCell> = Rswift.ReuseIdentifier(identifier: "NewsListingCell")
fileprivate init() {}
}
fileprivate struct intern: Rswift.Validatable {
fileprivate static func validate() throws {
try _R.validate()
}
fileprivate init() {}
}
fileprivate class Class {}
fileprivate init() {}
}
struct _R: Rswift.Validatable {
static func validate() throws {
#if os(iOS) || os(tvOS)
try storyboard.validate()
#endif
}
#if os(iOS) || os(tvOS)
struct storyboard: Rswift.Validatable {
static func validate() throws {
#if os(iOS) || os(tvOS)
try launchScreen.validate()
#endif
#if os(iOS) || os(tvOS)
try main.validate()
#endif
}
#if os(iOS) || os(tvOS)
struct launchScreen: Rswift.StoryboardResourceWithInitialControllerType, Rswift.Validatable {
typealias InitialController = UIKit.UIViewController
let bundle = R.hostingBundle
let name = "LaunchScreen"
static func validate() throws {
if #available(iOS 11.0, tvOS 11.0, *) {
}
}
fileprivate init() {}
}
#endif
#if os(iOS) || os(tvOS)
struct main: Rswift.StoryboardResourceWithInitialControllerType, Rswift.Validatable {
typealias InitialController = UIKit.UINavigationController
let bundle = R.hostingBundle
let name = "Main"
static func validate() throws {
if #available(iOS 11.0, tvOS 11.0, *) {
}
}
fileprivate init() {}
}
#endif
fileprivate init() {}
}
#endif
fileprivate init() {}
}