Stylistic differences btw Motion and Location interfaces #28
Unanswered
humblehacker
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@stephencelis @mbrandonw Both of your CoreMotion and CoreLocation libraries define "interfaces" in your concrete data type style - but there's a difference between the two libraries. The location library makes all of the method properties public, and has few actual
func
declarations.However, the motion library has non-public method properties and public
func
wrappers for those properties that take arguments.This is nicer as it improves the call site by being able to use argument labels. But since the vars are not public, library users can't easily change the implementation.
Also, since you can't have a property with a no-arg lambda and a
func
with the same signature,it's easy to miss the need to make those public. For example,
MotionManager
'savailableAttitudeReferenceFrames
should probably be public.In most respects I like the implementation in
MotionManager
better as it's a "cleaner" interface to use, but at the expense of the complete flexibility afforded by theLocationManager
implementation and a lot more boilerplate.Do you prefer one style over the other? Was it an intentional decision to keep the properties in
MotionManager
internal? Would you recommend this approach?Beta Was this translation helpful? Give feedback.
All reactions