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 SwiftUI | |
extension ContentSizeCategory: Identifiable { | |
var id: Int { hashValue } | |
} | |
//Example | |
struct HelloWorld_Previews: PreviewProvider { | |
static var previews: some View { | |
Group { |
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
// | |
// ContentView.swift | |
// Units | |
// | |
// Created by Ishmael Shabazz on 5/16/20. | |
// Copyright © 2020 Illuminated Bits LLC. All rights reserved. | |
// | |
import SwiftUI |
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 subclass of NSPersistentStore Coordinator | |
open class PersistentContainer: NSPersistentContainer { | |
} | |
lazy public var persistentContainer: PersistentContainer? = { | |
guard let modelURL = Bundle.module.url(forResource:"CoreDataSPM", withExtension: "momd") else { return nil } | |
guard let model = NSManagedObjectModel(contentsOf: modelURL) else { return nil } | |
let container = PersistentContainer(name:"CoreDataSPM",managedObjectModel:model) | |
container.loadPersistentStores(completionHandler: { (storeDescription, error) in |
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 SwiftUI | |
enum ComponentType{ | |
case sandwich | |
case smoothie | |
case soup | |
} | |
class Component: Identifiable, Hashable { | |
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
public func < (lhs:Date?, rhs:Date?) -> Bool { | |
let answer = false | |
if let lhs = lhs{ | |
if let rhs = rhs{ | |
return lhs.isBefore(date: rhs) | |
} | |
} | |
return answer |
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
tableView.performBatchUpdates({ | |
tableView.moveRow(at: sourceIndex, to: destinationIndexPath) | |
}, completion: { _ in }) | |
coordinator.drop(item, toRowAt: destinationIndexPath) |
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
enum StoryName:String{ | |
case main = "Main" | |
} | |
extension UIStoryboard{ | |
convenience init(name:StoryName, bundle:Bundle? = nil) { | |
self.init(name:name.rawValue, bundle: bundle) | |
} |