CHARTS
COLLECTIONVIEW
import Foundation | |
import CoreData | |
class CoreDataManager { | |
// MARK: - Core Data stack | |
static let sharedInstance = CoreDataManager() | |
private lazy var applicationDocumentsDirectory: URL = { | |
// The directory the application uses to store the Core Data store file. This code uses a directory named in the application's documents Application Support directory. | |
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) |
// | |
// Applogger.swift | |
// MyCatalogue | |
// | |
// Created by anoopm on 20/08/16. | |
// Copyright © 2016 anoopm. All rights reserved. | |
// | |
import Foundation |
struct Constants { | |
struct APIDetails { | |
static let APIScheme = "https" | |
static let APIHost = "restcountries.eu" | |
static let APIPath = "/rest/v1/alpha/" | |
} | |
} | |
private func createURLFromParameters(parameters: [String:Any], pathparam: String?) -> URL { |
// | |
// NetworkDataManager.swift | |
// | |
// Created by anoopm on 17/05/16. | |
import UIKit | |
enum Result<T, Error> { | |
case success(T) |
func copyFolder(){ | |
// Get the resource folder | |
if let resourceMainPath = Bundle.main.resourcePath{ | |
var isDirectory = ObjCBool(true) | |
// Get the path of the folder to copy | |
let originPath = (resourceMainPath as NSString).appendingPathComponent("NameOfFolder") | |
// Get the destination path, here copying to Caches | |
let destinationPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first! |
extension String{ | |
func asURLRequest()->URLRequest?{ | |
var urlRequest:URLRequest? | |
if self.isValidForUrl(){ | |
if let url = URL(string: self){ | |
urlRequest = URLRequest(url: url) | |
} | |
}else{ | |
urlRequest = nil |
CHARTS
COLLECTIONVIEW
let string = "This a string split using * and this is left." | |
if let range = string.range(of: "*") { | |
let lastPartIncludingDelimiter = string.substring(from: range.lowerBound) | |
print(lastPartIncludingDelimiter) // print * and this is left. | |
let lastPartExcludingDelimiter = string.substring(from: range.upperBound) | |
print(lastPartExcludingDelimiter) // print and this is left. | |
let firstPartIncludingDelimiter = string.substring(to: range.upperBound) | |
print(firstPartIncludingDelimiter) // print This a string split using * |
class <#Class#> { | |
// Private Init | |
private init() { } | |
// MARK: Shared Instance | |
private static let _shared = <#Class#> | |
// MARK: - Accessors | |
class func shared() -> <#Class#> { |