Skip to content

Instantly share code, notes, and snippets.

View tiwari1amrit's full-sized avatar

Amrit Tiwari tiwari1amrit

View GitHub Profile
@NeilsUltimateLab
NeilsUltimateLab / CodableResource.md
Last active April 5, 2021 03:30
Fetch resources using Alamofire with Codable.

CodableResource

Fetch resource using Alamofire with Codable.

This document shows the use of URLComponenent to decouple url by use of swift enums. By creating a Result<A> enum type error handling is done with ease. At the end defining the Codable User and Address structs allows the easy json-parsing.

import Foundation

URLScheme to declare the HTTP Scheme

enum URLScheme: String {

@dipkasyap
dipkasyap / CalculatorView.swift
Created December 14, 2016 11:18 — forked from natecook1000/CalculatorView.swift
An IBInspectable Calculator Construction Set
// CalculatorView.swift
// as seen in http://nshipster.com/ibinspectable-ibdesignable/
//
// (c) 2015 Nate Cook, licensed under the MIT license
/// The alignment for drawing an String inside a bounding rectangle.
enum NCStringAlignment {
case LeftTop
case CenterTop
case RightTop