This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class DictionaryEncoder { | |
private let encoder = JSONEncoder() | |
var dateEncodingStrategy: JSONEncoder.DateEncodingStrategy { | |
set { encoder.dateEncodingStrategy = newValue } | |
get { return encoder.dateEncodingStrategy } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Make sure that u are using latest facebook sdk 2020 | |
//pod 'FBSDKCoreKit' | |
//pod 'FBSDKLoginKit' | |
extension LoginVC { | |
@IBAction func facebook(_ sender: Any) { | |
self.loginWithReadPermissions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//call this method in view didload | |
self.hyperLinkSetup() | |
func hyperLinkSetup() { | |
let string = "Agree to our Terms & Conditions and Privacy Policy" | |
let attributedString = NSMutableAttributedString(string: string) | |
attributedString.addAttribute(.link, value: ApiBaseManager.hyperLinks.terms , range: (string as NSString).range(of: "Terms & Conditions")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://grokswift.com/json-swift-4/ | |
https://grokswift.com/decodable-with-alamofire-4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol MovieListTableViewDelegate: class { | |
func showMovieDetail(_ movie: Movie) | |
} | |
class MovieListTableViewDataSource: NSObject, UITableViewDataSource, UITableViewDelegate { | |
private weak var delegate: MovieListTableViewDelegate? | |
private let tableView: UITableView | |
var movies: [Movie] = [] { | |
didSet { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CropViewController | |
// pod 'CropViewController'. (required) | |
protocol NVImagePickerCropControllerDelegate: class { | |
func didSelect(image: UIImage) | |
} | |
class NVImagePickerCropController: NSObject { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol NvImagePickerDelegate: class { | |
func didSelect(image: UIImage) | |
} | |
class NvImagePicker: NSObject { | |
static let shared = NvImagePicker() | |
private var delegate: NvImagePickerDelegate? | |
private struct alertPicker { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//globle use in application | |
// example AppNetwork.current.baseURL | |
internal struct AppNetwork { | |
//used in APIBaseManager | |
private struct domainType { | |
static let dev = "https://www.projects.mytechnology.ae/homemade-supplier" | |
//static let staging = "http://www.homemadesupplier.ae" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//"Query Params Example- by nvd" | |
extension URL { | |
/// Returns a new URL by adding the query items, or nil if the URL doesn't support it. | |
/// URL must conform to RFC 3986. | |
func appending(_ queryItems: [URLQueryItem]) -> URL? { | |
guard var urlComponents = URLComponents(url: self, resolvingAgainstBaseURL: true) else { | |
// URL is not conforming to RFC 3986 (maybe it is only conforming to RFC 1808, RFC 1738, and RFC 2732) | |
return nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
//@nvd | |
//test example: check elements are equal between two array | |
struct Person { | |
var feature: Int? | |
var selectedId : Int? | |
} |
NewerOlder