This is a good writeup. I do have a couple notes about your style. I see several examples like
var expectedPath: Array<CGPoint> {
get { return _expectedPath }
set {
_expectedPath = newValue
drawExpectedPath(points: newValue)
}
}
Since your getters don't have any side effects, these computed properties can just use didSet to make things simpler:
var expectedPath: Array<CGPoint> {
didSet {
drawExpectedPath(points: newValue)
}
}
You don't have to deal with the _ variables or newValues.
And while we're using this example, it's much more idiomatic to declare Arrays and Dictionaries using [Type] and [KeyType: ValueType], respectively, so the previous example becomes
var expectedPath: [CGPoint] {
didSet {
drawExpectedPath(points: newValue)
}
}
I've issued a PR for your project with these changes. Let me know what you think!
I am a polyglot, full-stack developer with experience in front-end web development, back-end development including RESTful APIs, native iOS development, and devops. I am interested in software maintai
This is a good writeup. I do have a couple notes about your style. I see several examples like
Since your getters don't have any side effects, these computed properties can just use
didSet
to make things simpler:You don't have to deal with the
_
variables ornewValue
s.And while we're using this example, it's much more idiomatic to declare
Arrays
andDictionaries
using[Type]
and[KeyType: ValueType]
, respectively, so the previous example becomesI've issued a PR for your project with these changes. Let me know what you think!
Thanks Jason! I learned some new things!