magicalrecord

Introduction

MagicalRecord is a delightful, open-source, easy-to-use library that makes it simple to work with Core Data in your iOS and macOS applications.

Features

  • Automatically creates a Core Data stack
  • Convenient fetch request generation
  • Simplifies working with managed object contexts
  • Effortlessly handles multiple managed object models
  • Provides easy data importing and exporting
  • Includes extensive logging and error handling

Installation

MagicalRecord can be installed using various methods:

  • CocoaPods: Add the following line to your Podfile and run ‘pod install’:
    pod 'MagicalRecord'
  • Swift Package Manager: Add the package dependency to your Package.swift file:
    .package(url: "https://github.com/magicalpanda/MagicalRecord.git", from: "3.3.0")
  • Carthage: Add the following line to your Cartfile and run ‘carthage update’:
    github "magicalpanda/MagicalRecord"
  • Manually: Download the latest release from the GitHub repository, and manually add the files to your project.

Getting Started

To start using MagicalRecord in your project:

  1. Import the MagicalRecord module in your Swift file:
    import MagicalRecord
  2. Initialize MagicalRecord in your application delegate’s application(_:didFinishLaunchingWithOptions:) method:
    MagicalRecord.setupCoreDataStack()

Usage

MagicalRecord provides a variety of useful methods and utilities to work with Core Data. Some commonly used ones include:

  • MR_save: Save the current managed object context to persist changes.
  • MR_findAll: Fetch all objects of a specific entity.
  • MR_findFirst: Fetch the first object of a specific entity.
  • MR_deleteEntity: Delete a specific entity.

Documentation

For detailed instructions on using MagicalRecord, refer to the official GitHub repository. Additionally, you can explore the CocoaDocs page for comprehensive documentation.

Community

Join the community and get help with any questions or issues you may have. You can:

Conclusion

MagicalRecord allows you to work with Core Data effortlessly, simplifying many common tasks. Give it a try in your iOS or macOS projects and enjoy a seamless Core Data experience.