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 execute(with urlRquest: URLRequest) -> AnyPublisher<Data, NetworkPlataformError> { | |
| return urlSession | |
| .dataTaskPublisher(for: urlRquest) | |
| .tryMap { data, response in | |
| if let error = URLResponseErrorParser().parseErrorIfExists(on: response) { | |
| throw error | |
| } | |
| return 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
| func execute( | |
| with urlRquest: URLRequest, | |
| completion: @escaping (Result<Data, NetworkPlataformError>) -> Void) { | |
| urlSession.dataTask(with: urlRquest) { data, urlResponse, error in | |
| if let error = error { | |
| let errorParsed = NetworkPlataformErrorParser().parse(error) | |
| completion(.failure(errorParsed)) | |
| return | |
| } |
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 sum<T: Numeric>(x: T, y: T) -> T { | |
| return x + y | |
| } |
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
| enum Result<Value> { | |
| case success(Value) | |
| case failure(Error) | |
| } |
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
| import UIKit | |
| extension UIFont { | |
| enum FontStyle { | |
| case bold | |
| case book | |
| case light | |
| case regular | |
| } |
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 topicLabel = UILabelFactory(text: "Topic 1") | |
| .fontSize(of: 36) | |
| .build() | |
| private let subTopicLabel = UILabelFactory(text: "subTopic") | |
| .build() | |
| private let profileImageView = UIImageViewFactory(image: UIImage(named: "UserProfilePlaceHolder")) | |
| .build() | |
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
| import UIKit | |
| final class UILabelFactory { | |
| private let label: UILabel | |
| private let defultFontSize: CGFloat = 20 | |
| // MARK: - Inits | |
| init(text: String) { | |
| label = UILabel() | |
| label.textAlignment = .center |
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
| final class UILabelFactory { | |
| private let label: UILabel | |
| private let defultFontSize: CGFloat = 20 | |
| // MARK: - Inits | |
| init(text: String) { | |
| label = UILabel() | |
| label.textAlignment = .center | |
| label.text = text | |
| label.font = label.font.withSize(defultFontSize) |
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 topicLabel: UILabel = { | |
| let label = UILabel() | |
| label.text = "Topic" | |
| label.textAlignment = .center //textAlignment count = 1 | |
| label.font = label.font.withSize(36) | |
| label.translatesAutoresizingMaskIntoConstraints = false //translatesAutoresizingMaskIntoConstraints count = 1 | |
| return label | |
| }() | |
NewerOlder