Skip to content

Instantly share code, notes, and snippets.

@Akhu
Last active December 28, 2023 11:58
Show Gist options
  • Save Akhu/0d9d9bddbfa31f5659abd6e3ca6aca62 to your computer and use it in GitHub Desktop.
Save Akhu/0d9d9bddbfa31f5659abd6e3ca6aca62 to your computer and use it in GitHub Desktop.
//
// 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