Skip to content

Instantly share code, notes, and snippets.

View dilipiOSDeveloper's full-sized avatar
🏠
Working from home

Dilip Tiwari dilipiOSDeveloper

🏠
Working from home
View GitHub Profile
import UIKit
struct RequestType {
static let POST = "POST"
static let GET = "GET"
}
enum HtttpType: String {
case POST = "POST"
case GET = "GET"
@dilipiOSDeveloper
dilipiOSDeveloper / example.swift
Created November 4, 2019 11:29
Save the state of checkmarked cell in table view in swift 4.2
First of all rather than multiple arrays use a struct for the data source.
And don't use extra arrays or dictionaries to maintain the selection either, this is error-prone and unnecessarily expensive.
Add a boolean member to the struct for the selected state.
struct Course : Codable {
let name : String
let image : String
var isSelected : Bool
@dilipiOSDeveloper
dilipiOSDeveloper / library.swift
Last active July 29, 2021 12:53
Some Important Libraries and Links in Swift
let arrayOfTuples = [(0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1)]
let flattenedArray = arrayOfTuples.flatMap{ [$0.0, $0.1] }
security find-generic-password -ga WIFI NAME
https://developer.usebutton.com/guides/merchants/universal-links
https://johncodeos.com/how-to-add-uicollectionview-inside-uitableviewcell-using-swift/
https://github.com/johncodeos-blog
@dilipiOSDeveloper
dilipiOSDeveloper / extensionCollectionsDilip.swift
Last active March 20, 2023 19:04
Extension for CollectionView and TableView
import Foundation
public extension UICollectionView {
/**
Register nibs faster by passing the type - if for some reason the `identifier` is different then it can be passed
- Parameter type: UICollectionView.Type
- Parameter identifier: String?
*/
func registerCell(type: UICollectionViewCell.Type, identifier: String? = nil) {
let cellId = String(describing: type)