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
@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)
@dilipiOSDeveloper
dilipiOSDeveloper / gist:4af157b4dd2dad5fd06304b0ced62655
Created October 26, 2021 11:58
Filter from array based on particular key with higher order functions
var layers = [[String:Any]]() //Array
// Note:- Filter key which has currenVersion exists and also status key true
let currenVersion = UserDefaults.standard.value(forKey: udCurrentVersion) as? Int ?? 0
var temp = layers.filter { objfilter in
if let versions = objfilter["versions"] as? [String]
{
return (versions.contains(String(currenVersion)) || versions.contains("1,2") || versions.contains("2,1")) ? (objfilter["status"] as? Bool ?? false) : false
}
else
import UIKit
import GoogleMaps
import GooglePlaces
class ViewController: UIViewController,CLLocationManagerDelegate {
@IBOutlet weak var mapView: GMSMapView!
var coordinates: [CLLocationCoordinate2D] = []
var polygonPath = GMSPolyline()
var bounds = GMSCoordinateBounds()
@dilipiOSDeveloper
dilipiOSDeveloper / validate.swift
Created July 17, 2020 04:58
email id validation
// Datatype specifier
enum DataType: Int {
case Other = 0 // This can be string
case Number = 1
case Email = 2
}
@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 / navigation.swift
Created June 28, 2020 08:31
Setting Swift Navigation Bar Color with removing bottom seperator
self.navigationController?.navigationBar.barTintColor = UIColor(red: 0.0275, green: 0.4784, blue: 0.5922, alpha: 1.0)
self.navigationController?.navigationBar.setBackgroundImage(nil, for: .default)
self.navigationController?.navigationBar.setValue(true, forKey: "hidesShadow")
self.navigationController?.navigationBar.isTranslucent = false
{
"status": 1,
"message": "درخواست شما با موفقیت انجام شد",
"result": {
"ip_location": {
"id": "4534691",
"ip": "196.52.70.196",
"continent_code": "NA",
"continent_name": "North America",
"country_code2": "US",
@dilipiOSDeveloper
dilipiOSDeveloper / vc.swift
Created June 18, 2020 05:17
website for uploading IPA File
https://www.installonair.com/
https://www.diawi.com/
@dilipiOSDeveloper
dilipiOSDeveloper / gist:dbb13f2e4fbdf581b3d8269fec4048f9
Last active July 26, 2021 16:37
Git Commands to add Project to Github
git init
git add .
git commit -m "Initial project setup"
git remote add origin urlProject // urlProject is url of project u want to add
git push -u origin master // git push -f origin master
@dilipiOSDeveloper
dilipiOSDeveloper / books.swift
Created May 27, 2020 18:35
Swift Programming and SwiftUI Ebooks
Swift - https://blckbirds.com/wp-content/uploads/2020/02/SwiftProgramming1.0.pdf
SwiftUI - https://blckbirds.com/swiftui-tutorials/