@Vision Pro Engineer you are all over helping me! :-) I'm sorry if I'm not the best at providing the requested information, still very new to programming. I added the print statement, and It prints "ApplicantProcessor.Applicant" whenever adding. I would be happy to show how the NavigationSplitView is setup. Here is that file.
struct FilteredApplicantListView: View {
@State private var searchText = ""
var body: some View {
NavigationSplitView {
ApplicantListView(applicantFilter: searchText)
.searchable(text: $searchText, prompt: "Enter Name, Email, or Phone Number")
.autocorrectionDisabled(true)
} detail: { }
}
}
Here is my app file
struct ApplicantProcessorApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Applicant.self,
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(sharedModelContainer)
}
}
Here is what an Applicant looks like
import Foundation
import SwiftData
@Model
final class Applicant {
var name = ""
var email = ""
var phoneNumber = ""
var applicationDate = Date.now
var expirationDate: Date {
return Calendar.current.date(byAdding: .day, value: 90, to: applicationDate)!
}
private var _applicationStatus: ApplicationStatus?
var applicationStatus: ApplicationStatus {
get {
return _applicationStatus ?? .defaultState
}
set {
_applicationStatus = newValue
}
}
private var _applicantType: ApplicantType?
var applicantType: ApplicantType {
get {
return _applicantType ?? .standard
}
set {
_applicantType = newValue
}
}
private var _additionalFinancialRequirements: FinancialStatuses?
var additionalFinancialRequirements: FinancialStatuses {
get {
return _additionalFinancialRequirements ?? .defaultState
}
set {
_additionalFinancialRequirements = newValue
}
}
var coSignerApplicants = ""
var coSigners = ""
var applicantAppFolioURL = ""
var property = ""
var notes = ""
var requestedItems = ""
var photoID = false
var incomeDocumentation = false
var employmentRequirement = false
var studentDocumentation = false
var ssnVerification = false
var backgroundCheck = false
var evictionCheck = false
var stateCheck = false
var noPastDueBalances = false
var noGeneralCollections = false
var dtiApprovable = false
var creditScoreInRange = false
var noCosignerOrDoubleDepositRequired = false
var ableToScore = false
var creditScore = 0
var additionalApplicant = false
var additionalApplicantNames = ""
var additionalApplicantAppFolioLink = ""
private var _petType: PetType?
var petType: PetType {
get {
return _petType ?? .defaultState
}
set {
_petType = newValue
}
}
var petTypeCompatitable = false
var petScreeningComplete = false
var oldPetTypeCheck = false
var declineReasons = ""
init(name: String = "", email: String = "", phoneNumber: String = "", applicationDate: Date = Date.now, _applicationStatus: ApplicationStatus? = .defaultState, _applicantType: ApplicantType? = .standard, _additionalFinancialRequirements: FinancialStatuses? = .defaultState, coSignerApplicants: String = "", coSigners: String = "", applicantAppFolioURL: String = "", property: String = "", notes: String = "", requestedItems: String = "", photoID: Bool = false, incomeDocumentation: Bool = false, employmentRequirement: Bool = false, studentDocumentation: Bool = false, ssnVerification: Bool = false, backgroundCheck: Bool = false, evictionCheck: Bool = false, stateCheck: Bool = false, noPastDueBalances: Bool = false, noGeneralCollections: Bool = false, dtiApprovable: Bool = false, creditScoreInRange: Bool = false, noCosignerOrDoubleDepositRequired: Bool = false, ableToScore: Bool = false, creditScore: Int = 0, additionalApplicant: Bool = false, additionalApplicantNames: String = "", additionalApplicantAppFolioLink: String = "", _petType: PetType? = .defaultState, petTypeCompatitable: Bool = false, petScreeningComplete: Bool = false, oldPetTypeCheck: Bool = false, declineReasons: String = "") {
self.name = name
self.email = email
self.phoneNumber = phoneNumber
self.applicationDate = applicationDate
self._applicationStatus = _applicationStatus
self._applicantType = _applicantType
self._additionalFinancialRequirements = _additionalFinancialRequirements
self.coSignerApplicants = coSignerApplicants
self.coSigners = coSigners
self.applicantAppFolioURL = applicantAppFolioURL
self.property = property
self.notes = notes
self.requestedItems = requestedItems
self.photoID = photoID
self.incomeDocumentation = incomeDocumentation
self.employmentRequirement = employmentRequirement
self.studentDocumentation = studentDocumentation
self.ssnVerification = ssnVerification
self.backgroundCheck = backgroundCheck
self.evictionCheck = evictionCheck
self.stateCheck = stateCheck
self.noPastDueBalances = noPastDueBalances
self.noGeneralCollections = noGeneralCollections
self.dtiApprovable = dtiApprovable
self.creditScoreInRange = creditScoreInRange
self.noCosignerOrDoubleDepositRequired = noCosignerOrDoubleDepositRequired
self.ableToScore = ableToScore
self.creditScore = creditScore
self.additionalApplicant = additionalApplicant
self.additionalApplicantNames = additionalApplicantNames
self.additionalApplicantAppFolioLink = additionalApplicantAppFolioLink
self._petType = _petType
self.petTypeCompatitable = petTypeCompatitable
self.petScreeningComplete = petScreeningComplete
self.oldPetTypeCheck = oldPetTypeCheck
self.declineReasons = declineReasons
}
static let sampleData = [
Applicant(name: "John Doe", email: "johndoe@icloud.com", phoneNumber: "123-456-8897", _applicationStatus: .defaultState)
]
}