This file contains hidden or 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
func setLabel(_ value: NSAttributedString) { | |
myLabel.attributedText = value | |
myLabel.lineBreakMode = .byTruncatingTail | |
} |
This file contains hidden or 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
func setLabel(_ value: NSAttributedString) { | |
myLabel.attributedText = value | |
} |
This file contains hidden or 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 myLabel: UILabel = { | |
let label = UILabel() | |
label.numberOfLines = 1 | |
label.lineBreakMode = .byTruncatingTail | |
return label | |
}() |
This file contains hidden or 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
// | |
// PlayViewModel.swift | |
// brasileirao | |
// | |
// Created by Alcides Junior on 15/03/20. | |
// | |
import Foundation | |
typealias updateClosure = ()->() |
This file contains hidden or 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
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |
guard let _ = (scene as? UIWindowScene) else { return } | |
guard let windowScene = (scene as? UIWindowScene) else { return } | |
window = UIWindow(frame: windowScene.coordinateSpace.bounds) | |
window?.windowScene = windowScene | |
let navigation = UINavigationController(rootViewController: PlaysViewController()) | |
let rootView = navigation |
This file contains hidden or 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
// | |
// MagicConstraints+UIView.swift | |
// ArctouchQuizChallengeß | |
// | |
// Created by Alcides Junior on 13/01/20. | |
// Copyright © 2020 Alcides Junior. All rights reserved. | |
// | |
//USAGE EXAMPLE | |
startButton |
This file contains hidden or 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
func getAll(_ completion: @escaping (Result<Movie, Error>)->Void){ | |
let url = "\(self.moviesUrl)\(EndPoints.apiKey.rawValue)" | |
Just.get(url){ (result) in | |
guard let data = result.content else {return} | |
do{ | |
let decoder = JSONDecoder() | |
switch result.statusCode{ | |
case 401: | |
let errorDecoded = try decoder.decode(GenericErrors.self, from: data) |
This file contains hidden or 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
// | |
// FavoriteModel.swift | |
// iCinetop | |
// | |
// Created by Alcides Junior on 19/12/19. | |
// Copyright © 2019 Alcides Junior. All rights reserved. | |
// | |
import Foundation | |
import UIKit |
This file contains hidden or 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
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | |
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "movieCell", for: indexPath) as! MovieCollectionViewCell | |
cell.movieTitle.text = self.movies[indexPath.item].originalTitle | |
guard let imageUrl = URL(string: "\(EndPoints.baseImageUrl.rawValue)\(self.movies[indexPath.item].posterPath)") else{return cell} | |
DispatchQueue.main.async { | |
cell.movieImageView.load(url: imageUrl) | |
} | |
return cell | |
} |
This file contains hidden or 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
// | |
// MovieCollectionViewCell.swift | |
// iCinetop | |
// | |
// Created by Alcides Junior on 14/12/19. | |
// Copyright © 2019 Alcides Junior. All rights reserved. | |
// | |
import UIKit | |
import SnapKit |
NewerOlder