iOS Fundamentals of MVC.
The purpose of FUMVC is to provide common architectural abstractions in a very lean way, based on a clean and minimal MVC pattern.
Its implementation is embedded in the Fundamentals of MVC, and is intended to demonstrate how elegant MVC can be despite the FU animosity towards it, hence FUMVC 😉
Related references on FUMVC inclue the Lotus MVC pattern.
The initial implementation focuses on a Core Data abstraction, specifically a Model Controller using generics to reduce boilerplate code in Core Data CRUD operations.
iOS 11.0 or later, for NSPersistentContainer
support.
FUMVC is available through CocoaPods. Install by adding the following to the Podfile:
target "MyApp" do
pod "FUMVC", "~> 0.1.0"
end
FUMVC currently has a ModelController
to be used as an initial abstraction over Core Data.
You can use the ModelController
's convenience initalizer to reference the data model name like the following:
let modelController = ModelController(modelName: "Model")
Then say for example you have an NSManagedObject subclass called Recipe, create a new object like the following:
let newRecipe = modelController.add(Recipe.self)
newRecipe?.name = "Pizza"
There are other methods for:
add(type:)
total(type:)
fetch(type: predicate: sort:)
save()
delete(by objectID:)
delete(type: predicate:)
There is a small example with some unit tests. To run the example project, clone the repo, and run pod install
from the Example directory first.
FUMVC is available under the MIT license. See the LICENSE file for more info.