Commit 65faabf8 authored by Aral Balkan's avatar Aral Balkan

Clean up code

parent 1e56f1e7
Pipeline #696 canceled with stages
......@@ -42,7 +42,7 @@ class ViewController: UIViewController, UITextViewDelegate {
// Hard code the blocker state for the spike.
let blockerEnabled = false
let blockerEnabled = true
// Enable layout guides to debug layout and responsiveness.
let showLayoutGuides = false
......@@ -90,20 +90,19 @@ class ViewController: UIViewController, UITextViewDelegate {
for layoutElement in layoutElements { layoutElement!.backgroundColor = UIColor.white }
}
// Set the image view to align the image internally from the left while also satisfying aspect fit.
statusImageView.imageContentMode = LDImageContentModeScaleAspectFit
updateStatusImageHorizontalAlignmentBasedOnTraitCollection(self.traitCollection)
// Create the status text for the first time.
updateText()
// Update the status text and badge for the first time.
updateStatus()
}
func updateText() {
///
/// Update the status text and badge.
///
func updateStatus() {
print("===========")
print("Update text")
print("===========")
print("=============")
print("Update status")
print("=============")
let viewSize = view!.bounds.size
......@@ -136,14 +135,12 @@ class ViewController: UIViewController, UITextViewDelegate {
.adapt(.body),
.font(fontSet.title),
.color(.black),
// .lineHeightMultiple(0.7),
.paragraphSpacingAfter(fontSet.title.lineHeight/16.0)
)
let bodyStyle = StringStyle(
.adapt(.body),
.font(fontSet.body),
// .lineHeightMultiple(1),
.color(.gray)
)
......@@ -215,7 +212,7 @@ class ViewController: UIViewController, UITextViewDelegate {
func updateStatusImageHorizontalAlignmentBasedOnTraitCollection(_ traitCollection: UITraitCollection) {
var statusImageViewHorizontalAlignment: LDImageHorizontalAlignment
if traitCollection.verticalSizeClass == .compact {
// On compacy layouts, left-align the badge.
// On compact layouts, left-align the badge.
statusImageViewHorizontalAlignment = LDImageHorizontalAlignmentLeft
} else {
// On all other layouts, centre it.
......@@ -241,9 +238,11 @@ class ViewController: UIViewController, UITextViewDelegate {
print("Will transition to size: \(size).")
self.updateText()
self.updateStatus()
coordinator.animate(alongsideTransition: nil) {
/* with */ (coordinatorContext) in
/* when complete, handle */ (coordinatorContext) in
// Scroll the status text view to the top (in case the person’s Dynamic Type
// settings have made the text overflow the visible region). (Accessibility)
self.statusTextView.setContentOffset(.zero, animated: false)
......@@ -259,9 +258,8 @@ class ViewController: UIViewController, UITextViewDelegate {
// TODO: LEFT OFF: Set the image horizontal alignment based on the vertical size class.
// (Left for compressed, centre for all others.)
print("Will transition to new trait collection.")
updateText()
//updateStatusImageHorizontalAlignmentBasedOnTraitCollection(newCollection)
updateStatus()
}
......@@ -288,7 +286,5 @@ class ViewController: UIViewController, UITextViewDelegate {
}
return false
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment