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
private func addConstraints() { | |
// label constraints | |
textLabel.topAnchor.constraint(equalTo: view.topAnchor, constant: 50).isActive = true | |
textLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 8).isActive = true | |
textLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -8).isActive = true | |
textLabel.heightAnchor.constraint(equalToConstant: 30).isActive = true | |
// button constraints | |
showButton.topAnchor.constraint(equalTo: textLabel.bottomAnchor, constant: 16).isActive = true | |
showButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true | |
showButton.widthAnchor.constraint(equalToConstant: 100).isActive = true |
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
private let textLabel: UILabel = { | |
let label = UILabel() | |
label.textColor = .black | |
label.textAlignment = .center | |
label.numberOfLines = 0 | |
label.text = "My Label" | |
return label | |
}() | |
private var showButton: UIButton = { |
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 ViewController: UIViewController { | |
private let textLabel: UILabel = { | |
let label = UILabel() | |
label.translatesAutoresizingMaskIntoConstraints = false | |
label.textColor = .black | |
label.textAlignment = .center | |
label.numberOfLines = 0 | |
label.text = "My Label" | |
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
@objc private func showViewController(sender: UIButton) { | |
if let secondViewController = storyboard?.instantiateViewController(withIdentifier: “secondViewController”) as? SecondViewController { | |
present(secondViewController, animated: true, completion: nil) | |
} | |
} |
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 SecondViewController: UIViewController { | |
private lazy var textField: UITextField = { | |
let txt = UITextField() | |
txt.returnKeyType = .done | |
txt.backgroundColor = .groupTableViewBackground | |
txt.layer.cornerRadius = 3.0 | |
txt.translatesAutoresizingMaskIntoConstraints = false | |
txt.delegate = self | |
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
// | |
// SecondViewController.swift | |
// tutorial_closures | |
// | |
// Created by Dava on 5/6/17. | |
// Copyright © 2017 Davaur. All rights reserved. | |
// | |
import UIKit |
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
fileprivate var textLabel: UILabel = { | |
let label = UILabel() | |
label.translatesAutoresizingMaskIntoConstraints = false | |
label.textColor = .black | |
label.textAlignment = .center | |
label.numberOfLines = 0 | |
label.text = "My Label" | |
return label |
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
// | |
// CoreDataStack.swift | |
// altran_challenge | |
// | |
// Created by Dava on 7/7/17. | |
// | |
// | |
import Foundation | |
import CoreData |
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
struct MainViewModel { | |
private let locationServiceType: LocationServiceType | |
private let apiClientType: ApiClientType | |
private let addressCompletion: AddressCompletion | |
init(locationServiceType: LocationServiceType, apiClientType: ApiClientType, addressCompletion: @escaping AddressCompletion) { | |
self.locationServiceType = locationServiceType | |
self.apiClientType = apiClientType | |
self.addressCompletion = addressCompletion |
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
import Foundation | |
struct MainViewModel { | |
private let locationServiceType: LocationServiceType | |
private let apiClientType: ApiClientType | |
private let addressCompletion: AddressCompletion | |
init(locationServiceType: LocationServiceType, apiClientType: ApiClientType, addressCompletion: @escaping AddressCompletion) { | |
self.locationServiceType = locationServiceType |
OlderNewer