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
// MARK: LoginViewController | |
class LoginViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NotificationCenter.default.addObserver(self, | |
selector: #selector(handleLogin(notification:)), | |
name: Notification.Name("UserIdentifier"), |
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
// MARK: LoginViewController | |
class LoginViewController: UIViewController { | |
func login(with username: String, | |
password: String) { | |
let authenticationSession = AuthenticationSession() | |
authenticationSession.performLogin(with: username, | |
password: password) | |
} |
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
// MARK: Frameworks | |
import UIKit | |
// MARK: ViewController | |
class ShapeViewController: UIViewController { | |
// MARK: Outlets | |
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
// MARK: Frameworks | |
import UIKit | |
// MARK: UIBezierPath Methods | |
extension UIBezierPath { | |
convenience init(homeIn rect: CGRect) { | |
self.init() | |
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
// MARK: Frameworks | |
import UIKit | |
// MARK: Helper Methods | |
func radians(from degrees: CGFloat) -> CGFloat { | |
return ((degrees * .pi) / 180) | |
} |
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
// MARK: Frameworks | |
import Foundation | |
// MARK: Article | |
struct Articles: Decodable { | |
let count: Int | |
let results: [Article] | |
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
// MARK: Frameworks | |
import Foundation | |
// MARK: ArticleRemote | |
class ArticleRemote { | |
static func retrieveArticles(completion: @escaping(_ articles: Articles) -> Void) { | |
let session = URLSession(configuration: .default) | |
let apiURL: URL = URL(string: "https://api.nytimes.com/svc/mostpopular/v2/mostviewed/Technology/1.json")! |
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
// MARK: Frameworks | |
import UIKit | |
// MARK: ArticleViewController | |
class ArticleViewController: UIViewController { | |
// MARK: Outlets | |
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
// MARK: View Methods | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
loadItems() | |
} | |
// MARK: Action Methods | |
@IBAction func add(_ sender: Any?) { | |
guard let itemText = addTextField.text else { |
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
// MARK: Frameworks | |
import Foundation | |
import FirebaseDatabase | |
// MARK: ItemsRemote | |
class ItemsRemote { | |
// MARK: Constants |