Skip to content

Experimental mock-up of an idiomatic Swift API built over a putative core m-ld clone API on Apple platforms

License

Notifications You must be signed in to change notification settings

m-ld/m-ld-swift-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

m-ld Swift API Mock-Up

Experimental mock-up of an idiomatic Swift API built over a putative core m-ld clone API on Apple platforms.

entry points

summary

A m-ld "clone" takes the place of a Model in a conventional UI, with the benefit that it automatically stays up-to-date with changes made on other devices, with an eventual consistency guarantee. The core clone API is standardised across all platforms, based on JSON representation of RDF graphs, updates and queries; but on a specific platform an engine can benefit from an additional API layer that matches the local idioms.

The proposed Swift API is:

  • Object-oriented: information content is represented using classes having mutable state.
  • Reactive: changes to information are published to the app using Combine.
  • Based on Swift 5.5 concurrency, including async/await, structured concurrency, and Actors.
  • Intended to hide m-ld constructs where a Swift pattern exists, for example using Codable for serialisation.

The general usage pattern of this API by the app is:

  1. Instantiate a local clone representing the domain (details TODO)
  2. Make some selection of subjects (entities) from the domain using a query (at present, filtering by type)
  3. The subjects are realised as mutable objects of an application-provided class, implementing a protocol
  4. Each subject's reference graph (via properties) is transparently included
  5. Changes to the loaded graph are notified to the app via publishers
  6. The app can also stall remote changes while it makes local changes which are then committed in batch

acknowledgements

Based on https://github.com/JetBrains/ac_tutorial_swiftui

see also

About

Experimental mock-up of an idiomatic Swift API built over a putative core m-ld clone API on Apple platforms

Resources

License

Stars

Watchers

Forks

Languages