-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextButtonVC.swift
54 lines (37 loc) · 1.13 KB
/
TextButtonVC.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// TextButtonVC.swift
// pinknoise
//
// Created by Adam Tait on 2/20/18.
// Copyright © 2018 Sisterical Inc. All rights reserved.
//
import Foundation
import AsyncDisplayKit
class TextButtonVC : ButtonVC
{
static let defaultTextStyle : Style = [:]
// private properties
let titlePrimary : MutableProperty<String>
let buttonNode : ASButtonNode
// initializers
init(style: Style = [:], title: String)
{
self.titlePrimary = MutableProperty<String>(title)
let s = ASDisplayNode.cascade(styles: [TextButtonVC.defaultTextStyle, style])
self.buttonNode = ASButtonNode()
super.init(node: self.buttonNode, style: s)
set(title: title)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
// helpers
func set(title: String)
{
let s = self.node.styleset.get()!
buttonNode.setTitle(title,
with: s.font(),
with: s[.fgColor] as? UIColor,
for: .normal)
}
}