Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Plist 파일 구조와 Plist 파일에 저장된 데이터를 다루기 적합한 클래스를 설명하시오. #174

Open
sustainable-git opened this issue Sep 18, 2022 · 1 comment
Labels

Comments

@sustainable-git
Copy link
Member

No description provided.

@sustainable-git
Copy link
Member Author

  • plist는 환경 설정 정보를 포함하는 구조화된 text 또는 binary file로, xml 구조로 된 utf-8 file입니다. key, value값으로 이루어져 있습니다.
  • plist file은 NSDictionary 형태로 가져올 수 있습니다.
guard let url = Bundle.main.url(forResource: "UserInfo", withExtension: "plist") else { return }

// NSDictionary
guard let dictionary = NSDictionary(contentsOf: url) else { return }

//Struct
do {
    let data = try Data(contentsOf: url)
    let result = try PropertyListDecoder().decode(Model.self, from: data)
    
} catch {
    print(error.localizedDescription)
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant