refactored properties using this
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
13b5ea2a55
commit
e8da41eb70
@ -23,50 +23,20 @@ open class VDSLabel: UILabel, Modelable {
|
|||||||
@Published public var model: VDSLabelModel = DefaultLabelModel()
|
@Published public var model: VDSLabelModel = DefaultLabelModel()
|
||||||
private var cancellable: AnyCancellable?
|
private var cancellable: AnyCancellable?
|
||||||
|
|
||||||
public var fontSize: VDSFontSize {
|
@Proxy(\VDSLabel.model.fontSize)
|
||||||
get { model.fontSize }
|
public var fontSize: VDSFontSize
|
||||||
set {
|
|
||||||
if model.fontSize != newValue {
|
|
||||||
model.fontSize = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var textPosition: VDSTextPosition {
|
@Proxy(\VDSLabel.model.textPosition)
|
||||||
get { model.textPosition }
|
public var textPosition: VDSTextPosition
|
||||||
set {
|
|
||||||
if model.textPosition != newValue {
|
|
||||||
model.textPosition = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var fontWeight: VDSFontWeight {
|
@Proxy(\VDSLabel.model.fontWeight)
|
||||||
get { model.fontWeight }
|
public var fontWeight: VDSFontWeight
|
||||||
set {
|
|
||||||
if model.fontWeight != newValue {
|
|
||||||
model.fontWeight = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var fontCategory: VDSFontCategory {
|
@Proxy(\VDSLabel.model.fontCategory)
|
||||||
get { model.fontCategory }
|
public var fontCategory: VDSFontCategory
|
||||||
set {
|
|
||||||
if model.fontCategory != newValue {
|
|
||||||
model.fontCategory = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var surface: Surface {
|
@Proxy(\VDSLabel.model.surface)
|
||||||
get { model.surface }
|
public var surface: Surface
|
||||||
set {
|
|
||||||
if model.surface != newValue {
|
|
||||||
model.surface = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Initializers
|
//Initializers
|
||||||
public convenience init() {
|
public convenience init() {
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import Combine
|
|||||||
Container: The background of the toggle control.
|
Container: The background of the toggle control.
|
||||||
Knob: The circular indicator that slides on the container.
|
Knob: The circular indicator that slides on the container.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class DefaultToggleModel: DefaultLabelModel, VDSToggleModel {
|
public class DefaultToggleModel: DefaultLabelModel, VDSToggleModel {
|
||||||
public var id: String?
|
public var id: String?
|
||||||
public var inputId: String?
|
public var inputId: String?
|
||||||
@ -110,68 +109,26 @@ public class DefaultToggleModel: DefaultLabelModel, VDSToggleModel {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Computed Properties
|
// MARK: - Computed Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public var showText: Bool {
|
@Proxy(\VDSToggle.model.showText)
|
||||||
get { model.showText }
|
public var showText: Bool
|
||||||
set {
|
|
||||||
if model.showText != newValue {
|
|
||||||
model.showText = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var onText: String {
|
@Proxy(\VDSToggle.model.onText)
|
||||||
get { model.onText }
|
public var onText: String
|
||||||
set {
|
|
||||||
if model.onText != newValue {
|
|
||||||
model.onText = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var offText: String {
|
@Proxy(\VDSToggle.model.offText)
|
||||||
get { model.offText }
|
public var offText: String
|
||||||
set {
|
|
||||||
if model.offText != newValue {
|
|
||||||
model.offText = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var textPosition: VDSTextPosition {
|
@Proxy(\VDSToggle.model.textPosition)
|
||||||
get { model.textPosition }
|
public var textPosition: VDSTextPosition
|
||||||
set {
|
|
||||||
if model.textPosition != newValue {
|
|
||||||
model.textPosition = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var fontSize: VDSFontSize {
|
@Proxy(\VDSToggle.model.fontSize)
|
||||||
get { model.fontSize }
|
public var fontSize: VDSFontSize
|
||||||
set {
|
|
||||||
if model.fontSize != newValue {
|
|
||||||
model.fontSize = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var fontWeight: VDSFontWeight {
|
@Proxy(\VDSToggle.model.fontWeight)
|
||||||
get { model.fontWeight }
|
public var fontWeight: VDSFontWeight
|
||||||
set {
|
|
||||||
if model.fontWeight != newValue {
|
|
||||||
model.fontWeight = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var surface: Surface {
|
@Proxy(\VDSToggle.model.surface)
|
||||||
get { model.surface }
|
public var surface: Surface
|
||||||
set {
|
|
||||||
if model.surface != newValue {
|
|
||||||
model.surface = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open override var isEnabled: Bool {
|
open override var isEnabled: Bool {
|
||||||
get { !model.disabled }
|
get { !model.disabled }
|
||||||
@ -190,14 +147,8 @@ public class DefaultToggleModel: DefaultLabelModel, VDSToggleModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The state on the toggle. Default value: false.
|
/// The state on the toggle. Default value: false.
|
||||||
open var isOn: Bool {
|
@Proxy(\VDSToggle.model.on)
|
||||||
get { model.on }
|
open var isOn: Bool
|
||||||
set {
|
|
||||||
if model.on != newValue {
|
|
||||||
model.on = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Constraints
|
// MARK: - Constraints
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user