https://github.com/iosdevgarg/coredata_swift_demo
Core Data With A Separate Core Class that manages All The required Operations
https://github.com/iosdevgarg/coredata_swift_demo
core-data-tutorial coredata coredatabase swift swift-3 swift-4
Last synced: 3 months ago
JSON representation
Core Data With A Separate Core Class that manages All The required Operations
- Host: GitHub
- URL: https://github.com/iosdevgarg/coredata_swift_demo
- Owner: iOSDevGarg
- Created: 2018-02-05T06:59:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-05T07:18:30.000Z (over 8 years ago)
- Last Synced: 2025-01-20T08:23:06.343Z (over 1 year ago)
- Topics: core-data-tutorial, coredata, coredatabase, swift, swift-3, swift-4
- Language: Swift
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CoreData_Swift_Demo
Sample project Created To Give Basic Information of how to make use of Core Data
**This Project Consists -**
* Seprate Core Class , That managed All the required Operations in Core data
* Updating , Deleting, Creating and Finding a Record
* Looking for a Record With NSManagedObjet ID
# Relevant Code
**Get NSManaged Object Conetxt**
func getContext() -> AudioDetail
{
// Create an instance of the service.
let appDel = UIApplication.shared.delegate as! AppDelegate
let context: NSManagedObjectContext = appDel.persistentContainer.viewContext
//get Context from Class created
let AudioService = AudioDetail(context: context)
return AudioService
}
**Saving a New Record**
@IBAction func saveNewRecord(_ sender: Any)
{
if (self.doTextExists(TF: fileNameTF)) && (self.doTextExists(TF: durationTF)) && (self.doTextExists(TF: statusTF))
{
let AudioService = self.getContext()
_ = AudioService.create(fileName: fileNameTF.text!, duration: durationTF.text!, uploadedStatus: statusTF.text!)
}
else
{
self.BasicAlert("Error!", message: "All Fields Are Necessary", view: self)
}
}
# Basic UI
