This file contains hidden or 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
| //: [Previous](@previous) | |
| import SwiftUI | |
| import PlaygroundSupport | |
| struct ExampleView: View { | |
| @ObservedObject var fetcher: ImageFetcher | |
| init(fetcher: ImageFetcher) { | |
| self.fetcher = fetcher |
This file contains hidden or 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
| //: [Previous](@previous) | |
| import SwiftUI | |
| import PlaygroundSupport | |
| struct PillTextView<U>: View where U : StringProtocol{ | |
| let action: () -> () | |
| let label: U | |
This file contains hidden or 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
| @Environment(\.managedObjectContext) var managedObjectContext | |
| @State var year = "1880" | |
| @State var ascending = true | |
| @State var someValue = "value" | |
| @FetchRequest( | |
| entity: YearOfBirth.entity(), | |
| sortDescriptors: [NSSortDescriptor(key: "year", ascending: ascending.wrappedValue)], | |
| predicate: NSPredicate(format: "%K = %@", “someAttributeKey”, someValue.wrappedValue) | |
| ) var years: FetchedResults<YearOfBirth> |
This file contains hidden or 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 | |
| import CoreData | |
| import Combine | |
| struct NamesByYearView: View { | |
| @EnvironmentObject var coreDataStack: CoreDataStack | |
| @Environment(\.managedObjectContext) var managedObjectContext | |
| @EnvironmentObject var importer: NameDatabaseImporter | |
This file contains hidden or 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
| // | |
| // NamesByYearView.swift | |
| // NameList | |
| // | |
| // Created by Paul Wood on 7/31/19. | |
| // Copyright © 2019 Paul Wood. All rights reserved. | |
| // | |
| import SwiftUI | |
| import CoreData |
This file contains hidden or 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
| // | |
| // NamesByYearView.swift | |
| // NameList | |
| // | |
| // Created by Paul Wood on 7/31/19. | |
| // Copyright © 2019 Paul Wood. All rights reserved. | |
| // | |
| import SwiftUI | |
| import CoreData |
This file contains hidden or 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
| @Environment(\.managedObjectContext) var managedObjectContext | |
| @FetchRequest(fetchRequest: YearOfBirth.allFetchRequest()) var years: FetchedResults<YearOfBirth> |
This file contains hidden or 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
| struct Item: View, Identifiable { | |
| let forInt: Int | |
| var id: String { | |
| return "\(forInt)" | |
| } | |
| var body : some View { | |
| //: Make this view more complex | |
| HStack{ | |
| Text("\(forInt)") | |
| } |
This file contains hidden or 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
| // | |
| // ListOfAnimals.swift | |
| // AnimalList | |
| // | |
| // Created by Paul Wood on 8/4/19. | |
| // Copyright © 2019 Paul Wood. All rights reserved. | |
| // | |
| import SwiftUI |
This file contains hidden or 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
| struct NameHolder: Nameable { | |
| var id: String { return name } | |
| var name: String | |
| init<U>(nameable name: U) where U: Nameable { | |
| self.name = name.name | |
| } | |
| } |