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 | |
enum AppUrl { | |
static var baseUrl: String { | |
#if DEBUG | |
return "http://saurabhdev.com" | |
#elseif STAGGING | |
return "http://saurabhstagging.com" | |
#elseif RELEASE | |
return "http://saurabhlive.com" |
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
class ViewController: UIViewController { | |
@IBOutlet var tfName: UITextField! | |
@IBOutlet var tfAddress: UITextField! | |
@IBOutlet var tfPhone: UITextField! | |
@IBOutlet var tfEmail: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. |
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 Foundation | |
import CoreData | |
import UIKit | |
class DatabaseManager { | |
static var shared = DatabaseManager() // Created a shared instance so that we can use save function in the ViewController class | |
let context = (UIApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext // Creating a context for Core Data | |
// When you add CoreData to your project, Core Data stack is already added in App Delegate which contains all CRUD operations | |
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
class ViewController: UIViewController { | |
// Lazy stored property | |
lazy var memoryUsage: MemoryUsage = { | |
return MemoryUsage() | |
}() | |
// Stored property | |
var memoryUsage1 = MemoryUsage() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
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
// Create a structure | |
struct MemoryUsage { | |
func checkUsage() { | |
print ("Some value") | |
} | |
} |
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
// Create a structure | |
struct MemoryUsage { | |
func checkUsage() { | |
print ("Some value") | |
} | |
} |
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
if let pdfUrl = Bundle.main.url(forResource: "sample", withExtension: "pdf", subdirectory: nil, localization: nil) { | |
do { | |
let url = URL(string: "https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf") | |
let data = try Data(contentsOf: url!) | |
let sharedContent = [data] | |
let printController = UIPrintInteractionController.shared | |
let printInfo = UIPrintInfo(dictionary:nil) | |
printInfo.outputType = UIPrintInfoOutputType.general |
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
print (closureExample("Saurabh", "Dutta")) | |
} | |
var closureExample = { (firstName: String, lastName: String ) -> (String) in | |
return "\(firstName) \(lastName)" | |
} |
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
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; | |
[manager GET:@"http://www.HistoricalGurudwaras.com/Services/GuruSahib.svc/GetGuruSahibs" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) { | |
NSLog(@"JSON: %@", responseObject); | |
} failure:^(NSURLSessionTask *operation, NSError *error) { | |
NSLog(@"Error: %@", error); | |
}]; | |
NewerOlder