tmandry / Swindler

macOS window management library for Swift
https://tmandry.github.io/Swindler/docs/main/
MIT License
695 stars 66 forks source link

Consider making non-Promise property access prettier #21

Open tmandry opened 5 years ago

tmandry commented 5 years ago

It’s likely that all property reads and many writes will be done without promises. We can “split” the API into promise and non-promise based further up in the chain, to something like the following:

window.position = CGRect(x: 100, y: 200)
print(window.title)

window.async.size.set(CGSize(width: 300, height: 400)).then { ... }

The only problem with the above is that async implies that non-Promise accesses are performed synchronously (really, they are queued onto a background thread like everything else).