Skip to content

Instantly share code, notes, and snippets.

View rajkumar17's full-sized avatar

rajkumar17 rajkumar17

View GitHub Profile
//
// ViewController.swift
// PullDownSample
//
// Created by Dinesh Kumar on 15/08/16.
// Copyright © 2016 Organization. All rights reserved.
//
import UIKit
@rajkumar17
rajkumar17 / dispatch_once.swift
Created May 21, 2021 14:29 — forked from kristopherjohnson/dispatch_once.swift
Example of using dispatch_once() in Swift
import Foundation
var token: dispatch_once_t = 0
func test() {
dispatch_once(&token) {
println("This is printed only on the first call to test()")
}
println("This is printed for each call to test()")
}
@rajkumar17
rajkumar17 / ios-cell-registration-swift.md
Created February 14, 2022 05:37 — 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 registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@rajkumar17
rajkumar17 / gitflow-breakdown.md
Created February 25, 2022 06:17 — forked from morrismatts/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository