-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathRepository.swift
More file actions
34 lines (26 loc) · 886 Bytes
/
Copy pathRepository.swift
File metadata and controls
34 lines (26 loc) · 886 Bytes
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
/**
This file is part of the SFFocusViewLayout package.
(c) Sergio Fernández <fdz.sergio@gmail.com>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
*/
import Foundation
struct Repository: DataSource {
let items: [Resource] = Repository.resources
}
private extension Repository {
static var resources: [Resource] {
guard
let fileURL = Bundle.main
.url(forResource: Constant.filename, withExtension: Constant.fileExtension),
let resources = NSArray(contentsOf: fileURL) as? [[String: String]]
else {
fatalError("resource file not found")
}
return resources.compactMap(Parser.map)
}
private struct Constant {
static let filename = "Resources"
static let fileExtension = "plist"
}
}