Skip to content

Instantly share code, notes, and snippets.

View arjun011's full-sized avatar
😋
Lazy Coder

Arjun Patel arjun011

😋
Lazy Coder
  • Self
  • solihull B902DD
View GitHub Profile
@arjun011
arjun011 / PickerView.swift
Last active September 8, 2021 10:23
PickerView
//How to implement ?
let values = self.provinceList.compactMap{$0.name ?? ""}
let picker = PickerManager(input: values, selected: values.first) { (value, index) in
self.txtProvinces.text = value
self.provinceID = self.provinceList[index].provinceID ?? 0
}
self.txtProvinces.inputView = picker
//-- ViewController --
func retriveCountryAreaList(selectedCountry:String) {
if CacheDataManager.shared.countryAreaDataList != nil {
self.countryAreaList = CacheDataManager.shared.countryAreaDataList?.data ?? []
return
}
self.startLoading()
@arjun011
arjun011 / GET API
Last active August 29, 2019 06:22
Post Api using URLSession
/**
This method is used to call a GET API
- Parameter url: A String url to call POST Api.
- Parameter param: A Dictionary of API parameters.
- Parameter success: A Success block of API response.
- Parameter failure: A Failure block of API response.
*/
public typealias success = (_ response: JSON) -> Void
@arjun011
arjun011 / RoundedShadowView.swift
Last active September 8, 2021 10:24
Apply round and shadow effect on UIView
import Foundation
import UIKit
@IBDesignable class RoundShadowView: UIView {
@IBInspectable var shadow: Bool {
get {
return layer.shadowOpacity > 0.0
}
set {
if newValue == true {
@arjun011
arjun011 / ForceToUpdateApp.swift
Created June 26, 2019 06:14
Force Update iOS App while API has major update
final class ForceToUpdateApp {
static func isForceToUpdateRequired(versionNumber:Int) -> Bool {
if (UserDefaults.standard.object(forKey: "appVersion") as? String) == nil {
UserDefaults.standard.set(Bundle.main.releaseVersionNumber, forKey: "appVersion")
}
if (UserDefaults.standard.object(forKey: "apiVersion") as? Int) == nil {
UserDefaults.standard.set(versionNumber, forKey: "apiVersion")
}