Skip to content

Instantly share code, notes, and snippets.

View ARamy23's full-sized avatar
πŸ‘‹
Hello, there!

Ahmed Ramy ARamy23

πŸ‘‹
Hello, there!
View GitHub Profile
protocol CodableInit {
init(data: Data) throws
}
extension CodableInit where Self: Codable {
init(data: Data) throws {
protocol HandleAlamoResponse {
/// Handles request response, never called anywhere but APIRequestHandler
///
/// - Parameters:
/// - response: response from network request, for now alamofire Data response
/// - completion: completing processing the json response, and delivering it in the completion handler
func handleResponse<T: CodableInit>(_ response: DataResponse<Data>, completion: CallResponse<T>)
}
extension HandleAlamoResponse {
UserRouter.login(email: "ali@ali.gmail.com", password: "test12345").send(SwiftCairoUser.self) {[weak self] (response) in
switch response {
case .failure(let error):
// TODO: - Handle error as you want, printing isn't handling.
print(error)
@ARamy23
ARamy23 / DatePresenter+Builder.swift
Created March 15, 2022 11:18
Simplifies Date Parsing Process and displaying
import Foundation
// MARK: - Date Format & Components
extension Date {
// MARK: - Helper types
enum Format: String, CaseIterable {
/// 15/03/2022, 11:02 AM
case ddMMyyyyHHmmA = "dd/MM/yyyy, HH:mm a"
/// "18/10/1993"
case ddMMyyyySlashed = "dd/MM/yyyy"
import Foundation
class Model {
let id: String
let link: String
let resizedLink: String
func toDao() -> ModelDAO {
let dao: ModelDAO = .init()
// properties injection
import Foundation
import UIKit
enum WidgetType {
case search
case banner
}
class Interactor {
func buildWidgets() {