Skip to content

thepost/FUMVC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FUMVC

iOS Fundamentals of MVC.

Pod Swift: 4.1.x Platform License: MIT

Description

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.

Requirements

iOS 11.0 or later, for NSPersistentContainer support.

How to Install

FUMVC is available through CocoaPods. Install by adding the following to the Podfile:

target "MyApp" do
  pod "FUMVC", "~> 0.1.0"
end

How to Use

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:)

Example

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.

Author

Mike Post

License

FUMVC is available under the MIT license. See the LICENSE file for more info.