<commit_before>//
//  TodayViewController.swift
//  CountdownToday
//
//  Created by <NAME> on 04/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import NotificationCenter
import CountdownKit

@objc(TodayViewController)
class TodayViewController: UIViewController {

    //MARK: Properties

    let viewModel: CountdownViewModel

    let ageLabel: UILabel = {
        let ageLabel = UILabel()
        ageLabel.translatesAutoresizingMaskIntoConstraints = false
        ageLabel.textColor = .whiteColor()
        return ageLabel
    }()

    //MARK: Initialization

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        guard let userDefaults = NSUserDefaults(suiteName: CountdownViewModel.UserDefaultsSuiteName) else {
            fatalError("Can't initialize user defaults for app group")
        }

        viewModel = CountdownViewModel(userDefaults: userDefaults)
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    //MARK: UIViewController

    override func viewDidLoad() {
        super.viewDidLoad()
        preferredContentSize = CGSize(width: 0, height: 50)
        view.addSubview(ageLabel)
        NSLayoutConstraint(item: ageLabel, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0).active = true
        NSLayoutConstraint(item: ageLabel, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1, constant: 0).active = true

        if viewModel.birthday != nil {
            ageLabel.text = String(format: "%.12f", viewModel.age.value)
        } else {
            ageLabel.text = "Please open Countdown and set birthday"
        }
    }
}

//MARK: NCWidgetProviding

extension TodayViewController: NCWidgetProviding {

    func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)) {
        completionHandler(.NoData)
    }

    func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets {
        return UIEdgeInsetsZero
    }
}
<commit_msg>Use headline font size for age in today widget<commit_after>//
//  TodayViewController.swift
//  CountdownToday
//
//  Created by <NAME> on 04/11/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import NotificationCenter
import CountdownKit

@objc(TodayViewController)
class TodayViewController: UIViewController {

    //MARK: Properties

    let viewModel: CountdownViewModel

    let ageLabel: UILabel = {
        let ageLabel = UILabel()
        ageLabel.translatesAutoresizingMaskIntoConstraints = false
        let preferredFontSize = UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline).pointSize
        ageLabel.font = UIFont.monospacedDigitSystemFontOfSize(preferredFontSize, weight: UIFontWeightBold)
        ageLabel.textColor = .whiteColor()
        return ageLabel
    }()

    //MARK: Initialization

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        guard let userDefaults = NSUserDefaults(suiteName: CountdownViewModel.UserDefaultsSuiteName) else {
            fatalError("Can't initialize user defaults for app group")
        }

        viewModel = CountdownViewModel(userDefaults: userDefaults)
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    //MARK: UIViewController

    override func viewDidLoad() {
        super.viewDidLoad()
        preferredContentSize = CGSize(width: 0, height: 50)
        view.addSubview(ageLabel)
        NSLayoutConstraint(item: ageLabel, attribute: .CenterX, relatedBy: .Equal, toItem: view, attribute: .CenterX, multiplier: 1, constant: 0).active = true
        NSLayoutConstraint(item: ageLabel, attribute: .CenterY, relatedBy: .Equal, toItem: view, attribute: .CenterY, multiplier: 1, constant: 0).active = true

        if viewModel.birthday != nil {
            ageLabel.text = String(format: "%.12f", viewModel.age.value)
        } else {
            ageLabel.text = "Please open Countdown and set birthday"
        }
    }
}

//MARK: NCWidgetProviding

extension TodayViewController: NCWidgetProviding {

    func widgetPerformUpdateWithCompletionHandler(completionHandler: ((NCUpdateResult) -> Void)) {
        completionHandler(.NoData)
    }

    func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets {
        return UIEdgeInsetsZero
    }
}

{'fraction_non_alphanumeric': 0.09236690186016677, 'fraction_numerical': 0.008124866367329484, 'mean_word_length': 3.3475836431226766, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1553754', 'n_tokens_mistral': 1405, 'n_tokens_neox': 1295, 'n_words': 321}