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 | |
| protocol FeedDisplayLogic: AnyObject { | |
| } | |
| final class FeedViewController: UIViewController { | |
| var interactor: FeedBusinessLogic? | |
| var router: (FeedRoutingLogic & FeedDataPassing)? |
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 Foundation | |
| public class Coupon: PanpaDecodable { | |
| var id: String = "" | |
| var name: String = "" | |
| var no: String = "" | |
| var isOpen: Bool = false | |
| var matches: [PMatches] = [] | |
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
| public class User: PanpaDecodable { | |
| var username: String? | |
| var name: String? | |
| var surname: String? | |
| var email: String? | |
| var uid: String? | |
| enum CodingKeys: String, CodingKey { | |
| case username, name, surname, email, uid |
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 Foundation | |
| protocol PanpaDecodable: Decodable & Keyable { } | |
| protocol Keyable { | |
| static var codingKey: String { get } | |
| } |
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
| { | |
| "message" : "", | |
| "status" : 1, | |
| "user" : { | |
| "uid" : "XXX-XXX-XXX", | |
| "surname" : "Ramazanov", | |
| "username" : "Rashid", | |
| "email" : "rashid.ramazanov@gmail.com", | |
| "name" : "Rashid", | |
| } |
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
| { | |
| "message": "", | |
| "status": 0, | |
| "coupon": { | |
| "cpnid": "XXX-XXX-XXX", | |
| "couponname": "29.Kupon", | |
| "couponno": "29", | |
| "iscouponopen" : false, | |
| "matches": [ | |
| { |
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 Alamofire | |
| ... | |
| private func getCoupon() { | |
| let urlStr = "\(serverUrl)\(EndpointTails.group_last_coupon_one.rawValue)" | |
| AF.request(urlStr, method: .get).responseDecodable { (response: DataResponse<PanpaResponse<Coupon>, AFError>) in | |
| if let panpaResponse = response.value { | |
| switch panpaResponse.status { | |
| case .success: | |
| guard let coupon: Coupon = panpaResponse.data else { return } | |
| print(coupon.name) |
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 Alamofire | |
| ... | |
| func login() { | |
| let urlStr = "\(serverUrl)\(EndpointTails.login.rawValue)" | |
| AF.request(urlStr, method: .get).responseDecodable { (response: DataResponse<PanpaResponse<User>, AFError>) in | |
| if let panpaResponse = response.value { | |
| switch panpaResponse.status { | |
| case .success: | |
| guard let user: User = panpaResponse.data else { return } | |
| print(user.username) |
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 Foundation | |
| struct PanpaResponse<T>: Decodable where T: Decodable { | |
| private var statusInt: Int? | |
| var status: Status { | |
| if statusInt == 1 || statusInt == 0 { | |
| return .success | |
| } | |
| return .failed |
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
| { | |
| "message": "", | |
| "status": 0, | |
| "data": { | |
| "cpnid": "XXX-XXX-XXX", | |
| "couponname": "29.Kupon", | |
| "couponno": "29", | |
| "iscouponopen" : false, | |
| "matches": [ | |
| { |