git init
git status
git add [filename] (add to staging area)
git add -A (add all to staging)
git reset [filename] (remove from staging)
git commit -m “message” (commit from staging)
git commit -a -m “message” (stage and commit)
git clone
| // Mark "Item" struct as Codable | |
| var itemArray: [Item] = [] | |
| let dataFilePath = | |
| FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) | |
| .first? | |
| .appendingPathComponent("Items.plist") | |
| func loadModel() { | |
| if let data = try? Data(contentsOf: dataFilePath!) { |
| // App Delegate | |
| import CoreData | |
| func applicationWillTerminate(_ application: UIApplication) { | |
| self.saveContext() | |
| } | |
| // MARK: - Core Data stack | |
| lazy var persistentContainer: NSPersistentContainer = { |
| // | |
| // ViewController.swift | |
| // WhatFlower | |
| // | |
| // Created by Greg Eales on 17/10/20. | |
| // | |
| import UIKit | |
| // TODDO: Add to .plist |
| import CoreML | |
| import Vision | |
| func detectImage(image: CIImage) { | |
| guard let model = try? VNCoreMLModel(for: FlowerClassifier().model) else { | |
| fatalError("Could not load CoreML model") | |
| } | |
| let request = VNCoreMLRequest(model: model) { (request, err) in | |
| guard let results = request.results as? [VNClassificationObservation] else { |
Create a Podfile at the root of your project
platform :ios, '5.0'
pod 'AFNetworking'
pod 'OHAttributedLabel'| // Custom closure with escaping | |
| func getSentimentScore(searchTerm: String, scoreCallback: @escaping (_ score: Int) -> Void) { | |
| } |
| import Cocoa | |
| struct entry { | |
| let date: Date | |
| let vol: Measurement<UnitVolume> | |
| } | |
| let entries = [ |