Reading Files in Swift
Reading Files in Swift
func loadJsonAsync() {
DispatchQueue.global(qos: .background).async {
if let path = Bundle.main.path(forResource: "ํ๊ธ.min", ofType: "json") {
do {
let data = try Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe)
let jsonResult = try JSONSerialization.jsonObject(with: data, options: .mutableLeaves)
if let jsonResult = jsonResult as? [String: Any], let ๋ฐ์ดํฐ = jsonResult as? [String: [String: String]] {
self.ํ๊ธ = ๋ฐ์ดํฐ
}
} catch {
exit(1)
}
}
}
}