Giter Club home page Giter Club logo

minerva's Introduction

Minerva

Build Status codecov Version License

Minerva is an easy to use framework for structuring iOS, iPadOS and TvOS applications. It's key features include:

  • A simplified Swift friendly MVVM framework built on top of IGListKit.
  • A Coordinator framework that is similar to working with UIViewControllers.
  • Common re-usable CollectionView cells for building an application.

QuickStart

See the MinervaExample project for a full-featured example application built with Minerva.

Coordinator

/// A Coordinator handles the state transition between Coordinators. This logic was previously part of the UIViewController's.
public protocol Coordinator: AnyObject {
	var parent: Coordinator? { get set }
	var childCoordinators: [Coordinator] { get set }
}

Navigator

/// Manages the presentation of view controllers both modally and through a navigation controller.
public protocol Navigator: UIAdaptivePresentationControllerDelegate, UINavigationControllerDelegate {
	/// The block to use when a view controller is removed from the navigation controller.
	typealias RemovalCompletion = (UIViewController) -> Void

	/// Displays a view controller modally.
	/// - Parameter viewController: The view controller to display.
	/// - Parameter animated: Whether or not to animate the transition.
	/// - Parameter completion: The completion to be called when the view controller is no longer on the view stack.
	func present(_ viewController: UIViewController, animated: Bool, completion: RemovalCompletion?)

	/// Removes a modally presented view controller from the view stack.
	/// - Parameter viewController: The view controller to remove.
	/// - Parameter animated: Whether or not to animate the transition.
	/// - Parameter completion: The completion to be called when the view controller is no longer on the view stack.
	func dismiss(_ viewController: UIViewController, animated: Bool, completion: RemovalCompletion?)

	/// Displays a view controller in the navigators navigation controller.
	/// - Parameter viewController: The view controller to display.
	/// - Parameter animated: Whether or not to animate the transition.
	/// - Parameter completion: The completion to be called when the view controller is no longer on the view stack.
	func push(_ viewController: UIViewController, animated: Bool, completion: RemovalCompletion?)

	/// Sets the view controller's in the navigators navigation controller.
	/// - Parameter viewControllers: The view controllers to display.
	/// - Parameter animated: Whether or not to animate the transition.
	/// - Parameter completion: The completion to be called when the view controller is no longer on the view stack.
	func setViewControllers(_ viewControllers: [UIViewController], animated: Bool, completion: RemovalCompletion?)

	/// Removes all but the top view controller from the Navigator's navigation controller.
	/// - Parameter animated: Whether or not to animate the transition.
	@discardableResult
	func popToRootViewController(animated: Bool) -> [UIViewController]?

	/// Removes all view controller's above the provided view controller from the Navigator's navigation controller.
	/// - Parameter viewController: The view controller to display.
	/// - Parameter animated: Whether or not to animate the transition.
	@discardableResult
	func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]?

	/// Removes the top navigation controller from the navigation stack.
	/// - Parameter animated: Whether or not to animate the transition.
	@discardableResult
	func popViewController(animated: Bool) -> UIViewController?
}

ListCellModel

/// The model that will bind to a cell.
public protocol ListCellModel {
	/// A unique identifier for the cell model. If the model identifiers are different,
	/// the cells are assumed to be completely different triggering a delete and
	/// an insert of a new cell.
	var identifier: String { get }

	/// The type of list cell that this model should be bound to.
	var cellType: ListCollectionViewCell.Type { get }

	/// Determines if two models with the same identifier are equal. If they are not, then the cell is reloaded and bound to the new model.
	/// - Parameter model: The model to compare against.
	func identical(to model: ListCellModel) -> Bool

	/// Provides the size that the models cell will need.
	/// - Parameter containerSize: The max size that the cell can occupy.
	/// - Parameter templateProvider: Provides a template cell to size against when supplying an explicit size.
	func size(constrainedTo containerSize: CGSize, with templateProvider: () -> ListCollectionViewCell) -> ListCellSize
}

Installation

CocoaPods

Minerva supports installation via CocoaPods. You can depend on Minerva by adding the following to your Podfile:

pod "Minerva"

Bugs / Contributions

If you encounter bugs or missing features in Minerva, please feel free to open a GitHub issue or send out a PR.

Contributions and bug fixes are appreciated.

License

Minerva is licensed under the permissive MIT license.

See Also

minerva's People

Contributors

jlaws avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.