Created
May 5, 2017 21:38
-
-
Save jonathontoon/1ba483045679f43d091118394c91e4ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyViewController { | |
let titleOfGoal: String; | |
let titleLabel: UILabel; | |
let goalLabels: [UILabel]; | |
let goalObjects: Array; | |
init(t: String) { | |
super.init(); | |
titleOfGoal = t; | |
goalObjects = [ | |
{ | |
"title": "Do thing 1", | |
},{ | |
"title": "Do thing 2", | |
},{ | |
"title": "Do thing 3", | |
}, | |
]; | |
} | |
viewDidLoad() { | |
super.viewDidLoad(); | |
titleLabel = UILabel(string: titleOfGoal); | |
// Style, do stuff with autolayout, or size frame... | |
addSubview(titleLabel); | |
for goal in goalObjects { | |
let goalLabel = UILabel(string: goal.title); | |
// Style, do stuff with autolayout, or size frame... | |
let tapGesture = UITapGestureRecognizer(); | |
// Config your tap gesture... | |
goalLabels.addGestureRecognizer(tapGesture); | |
goalLabels.append(goalLabel); | |
addSubview(goalLabel); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment