Skip to content

Instantly share code, notes, and snippets.

@andreaantonioni
andreaantonioni / ios-cell-registration-swift.md
Last active July 15, 2021 13:41 — forked from gonzalezreal/ios-cell-registration-swift.md
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func register(_ cellClass: AnyClass?, forCellReuseIdentifier identifier: String)
public func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)
@djovanovski
djovanovski / Networking.swift
Last active March 7, 2017 21:16
Wrapper for API calls in Swift 3.0 using Alamofire
//
// Networking.swift
// Networking
//
// Created by Darko Jovanovski on 12/10/16.
// Copyright © 2016 Darko Jovanovski. All rights reserved.
//
import UIKit
import Alamofire
@chriswebb09
chriswebb09 / APIClient.swift
Last active March 7, 2017 21:12
Networking With Protocols Swift
import Foundation
protocol APIClient {
func downloadData()
func downloadImage()
}
struct Client:APIClient {
var request: URLRequest
var networkCall: APIRequest
@ashishkakkad8
ashishkakkad8 / AFWrapper.swift
Last active January 13, 2020 07:08
Alamofire - SwiftyJSON Wrapper
//
// AFWrapper.swift
// AFSwiftDemo
//
// Created by Ashish on 10/4/16.
// Copyright © 2016 Ashish Kakkad. All rights reserved.
//
import UIKit
import Alamofire