So I installed the pod for Vox on github and it's not building at all. Instead, I keep getting the error below.
I through overriding just meant referring to the class in a different place and changing its computer properties? I'm not sure why it's building and would love some help.
open class var resourceType: String {
fatalError("Must override `static var resourceType: String`")
}
You need to override the class. An example class can be found in the Vox repo.
The class Player
is a subclass of Resource
. It overrides the resourceType
variable. The overridden variable returns the string "Player"
. Note that it does not return super.resourceType
since that would call fatalError
.
fileprivate class Player: Resource {
override class var resourceType: String {
return "Player"
}
@objc dynamic var items: [Resource]?
@objc dynamic var titles: [String]?
}
A more general example of overriding taken from Overriding properties in swift is:
public class FooButton {
public var weight: Double = 1.0
}
public class BarButton: FooButton {
override public var weight: Double = 2.0
}