Last active
December 28, 2023 11:58
-
-
Save Akhu/0d9d9bddbfa31f5659abd6e3ca6aca62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PlistManager.swift | |
// Unsplash SwiftUI | |
// | |
// Created by Anthony Da cruz on 09/12/2023. | |
// | |
import Foundation | |
struct ConfigData: Codable { | |
let clientId: String | |
enum CodingKeys: String, CodingKey { | |
case clientId = "client_id" | |
} | |
} | |
class ConfigurationManager { | |
static var instance = ConfigurationManager() | |
internal let plistDictionnary: ConfigData | |
init() { | |
let url = Bundle.main.url(forResource: "environment", withExtension:"plist")! | |
do { | |
let data = try Data(contentsOf: url) | |
let result = try PropertyListDecoder().decode(ConfigData.self, from: data) | |
self.plistDictionnary = result | |
} catch { fatalError("Could not boot app without configuration plist") } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment