Skip to content

Implement data model using Codable#4

Draft
tonyarnold wants to merge 1 commit into
notiflux:masterfrom
tonyarnold:codable
Draft

Implement data model using Codable#4
tonyarnold wants to merge 1 commit into
notiflux:masterfrom
tonyarnold:codable

Conversation

@tonyarnold

@tonyarnold tonyarnold commented May 15, 2019

Copy link
Copy Markdown
Collaborator

This PR aims to decode and encode the configuration property lists using Swift's Codable protocol.

The PR is currently a work in progress, and is not ready for use.

let data = try Data(contentsOf: openedFileURL)
let decoder = PropertyListDecoder()
let configuration = try decoder.decode(Configuration.self, from: data)

What's left to do?

  • Refine the model - this is a first pass, and some of the models (notably DeviceProperties and NVRAM) are basically glorified dictionaries right now.
  • Decoding model to memory for use when the user opens a file
  • Using the model to populate a proper document, as well as views
  • Saving model back to disk
    • Saving should omit values that are equal to their defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant