Classes
The following classes are available globally.
-
A helper for adding top and bottom shadows into any UIScrollView-based class. You create an instance in your subclass and forward calls from layoutSubviews.
See moreDeclaration
Objective-C
@interface MMMScrollViewShadows : NSObject
Swift
class MMMScrollViewShadows : NSObject
-
Holds configuration for MMMScrollViewShadows that can be set only on initialization time.
See moreDeclaration
Objective-C
@interface MMMScrollViewShadowsSettings : NSObject
Swift
class MMMScrollViewShadowsSettings : NSObject
-
A view that’s used internally to render shadows in MMMAutoLayoutScrollView. Open for reuse in cases we want to display compatible shadows but differntly controlled. Note that this does not support Auto Layout, you have to manage its frame.
See moreDeclaration
Objective-C
@interface MMMScrollViewShadowView : UIView
Swift
class MMMScrollViewShadowView : UIView
-
Web view supporting top & bottom shadows.
See moreDeclaration
Objective-C
@interface MMMWebView : WKWebView
Swift
class MMMWebView : WKWebView
-
A base for table view cells redeclareing the designated initializer into the one we typically use, so subclasses do not have to.
See moreDeclaration
Objective-C
@interface MMMTableViewCell : UITableViewCell
Swift
class MMMTableViewCell : UITableViewCell
-
A simple table view cell wrapping the given view.
This is handy when you have a view already and just want to show it as one more cell.
The view being wrapped should support Auto Layout and inflate its height properly. The cell has its
See moreselectionStyle
set toUITableViewCellSelectionStyleNone
as these kind of cells typically do not appear selected.Declaration
Objective-C
@interface MMMViewWrappingCell<ViewType> : MMMTableViewCell
Swift
class MMMViewWrappingCell<ViewType> : MMMTableViewCell where ViewType : AnyObject
-
Opening a deep link can involve following through one or more steps, for example:
1) make sure the main screen is visible and can switch between the pages; 2) move to the recipes page; 3) open recipe with ID N; 4) scroll to ingredients, etc.
This is a single step in such a chain.
See moreDeclaration
Objective-C
@interface MMMNavigationHop : NSObject
Swift
class MMMNavigationHop : NSObject
-
A navigation path is just a collection of one or more “hops”.
See moreDeclaration
Objective-C
@interface MMMNavigationPath : NSObject
Swift
class MMMNavigationPath : NSObject
-
Manages switching between different sections of the app (kind of internal URL router). It’s like a central hub accepting navigation requests and then passing them to the entities that able to perform them. (The entities that are able to open requests should register themselves as handlers.)
See moreDeclaration
Objective-C
@interface MMMNavigation : NSObject
Swift
class MMMNavigation : NSObject
-
Info about a navigation request that is passed to handlers.
See moreDeclaration
Objective-C
@interface MMMNavigationRequest : NSObject
Swift
class MMMNavigationRequest : NSObject
-
This is to be used during development to stub not ready yet parts of the app.
See moreDeclaration
Objective-C
@interface MMMStubViewController : UIViewController
Swift
class MMMStubViewController : UIViewController
-
A limited replacement for UIImageView fixing its inability to properly work with images having non-zero alignmentRectInsets when scaled.
Note that this view is already constrained to the aspect ratio of the image’s alignment rect, so you should not use hard (equal) pins against both width and height or against all edges.
See moreDeclaration
Objective-C
@interface MMMImageView : UIView
Swift
class MMMImageView : UIView
-
A vertical scroll view with a content view and preconfigured constraints, so there is no need in creating a scroll view / content view sandwitch manually every time.
It also supports top and bottom shadows that are displayed only when the content is clipped. The shadows can be enabled individually and they can sit either flush with the edges of the scroll view or can be inset according to
adjustedContentInset
, which can be handy when verticalsafeAreaInsets
need to be taken into account. (Note thatcontentInsetAdjustmentBehavior
has to be eitherNone
orAlways
on this view since “automatic” options can lead to cyclic calculations.) Also note that scroll indicators are disabled here by default.Begin by adding your controls and constraints into the
contentView
ensuring that its size can be derived from your constraints alone. Avoid constraints to the scroll view itself or outside views unless you are prepared to deal with the consequences.Note that the width of the
See morecontentView
will be constrainted hard to be equal to the width of the scroll view and its height will be constrained with prio 251 to be at least as large as the height of the scroll view.Declaration
Objective-C
@interface MMMAutoLayoutScrollView : UIScrollView
Swift
class MMMAutoLayoutScrollView : UIScrollView
-
A subview of MMMAutoLayoutScrollView where all the subviews should be added.
- (It’s not different from UIView, but making it of its own class helps when browsing view hierarchies.)
Declaration
Objective-C
@interface MMMAutoLayoutScrollViewContentView : UIView
Swift
class MMMAutoLayoutScrollViewContentView : UIView
-
To be used during development as a placeholder for not yet implemented views. It inherits a vertical scroll view so it’s possible to see that gesture recognizers of the container do not interfere with a typical scrolling.
See moreDeclaration
Objective-C
@interface MMMStubView : UIScrollView
Swift
class MMMStubView : UIScrollView
-
This is to track the navigation state of the app and have the possibility to programmatically return to registered points of the navigation path. The actual navigation entities of the app (usually view controllers) must cooperate in order to achieve this.
The possibility to go back is needed to properly handle in-app links. We have a basic mechanism for this (MMMNavigation) which allows to “open” a part of a link and forward the remaining parts to the corresponding handler down the navigation tree. The handlers thus need to be able to “close” current navigation path before opening something new.
Although navigation in the app is better represented by a tree, we assume here that at least the current path in this tree can be represented as a stack. Each element of the stack can correspond to a modal view controller or alert view, for example, but it can also correspond to a special state of the app or a screen.
See moreDeclaration
Objective-C
@interface MMMNavigationStack : NSObject
Swift
class MMMNavigationStack : NSObject
-
A table view supporting top and bottom shadows.
See moreDeclaration
Objective-C
@interface MMMTableView : UITableView <MMMPreferredSizeChanges>
Swift
class MMMTableView : UITableView, MMMPreferredSizeChanges
-
Holds configuration for MMMShadowView.
See moreDeclaration
Objective-C
@interface MMMShadowViewSetting : NSObject
Swift
class MMMShadowViewSetting : NSObject
-
Helper view for adding custom layer shadows, while taking the the shadow sizes in conserderation for its final frame.
See moreDeclaration
Objective-C
@interface MMMShadowView : UIView
Swift
class MMMShadowView : UIView
-
Auto Layout does not support constraints against groups of items, so this is for the cases a normal UIView is typically used as a container for such a group. Unlike UIView we have translatesAutoresizingMaskIntoConstraints set to NO already. Also
See moreMMMContainerView
does not intercept touches but subviews still do.Declaration
Objective-C
@interface MMMContainerView : UIView
Swift
class MMMContainerView : UIView
-
This is to group a few simple layout helpers.
See moreDeclaration
Objective-C
@interface MMMLayoutUtils : NSObject
Swift
class MMMLayoutUtils : NSObject
-
A little helper for velocity/acceleration calculations: you feed it values with timestamps and can get the most recent acceleration/velocity values.
See moreDeclaration
Objective-C
@interface MMMVelocityMeter : NSObject
Swift
class MMMVelocityMeter : NSObject
-
Minimalistic animation helpers.
Terminology:
- Normalized time — time value from the [0; 1] range.
- Curved time — normalized time transformed using one of the predefined animation curves.
Declaration
Objective-C
@interface MMMAnimation : NSObject
Swift
class MMMAnimation : NSObject
-
Minimalistic animator object in the spirit of helpers defined in MMMAnimation.
You add animation items, which are basically a set of blocks that will be called every frame on the main run loop and when it’s done or cancelled.
It’s not for every case, it’s for those moments when you know the duration in advance and just need to animate a simple custom property and don’t want to subclass CALayer or mess with its multithreaded delegates.
The animator object does not take care of interpolation of values nor time curves, the normalized time passed into update blocks can be transformed and values can be interpolated using simple helpers in MMMAnimation.
See moreDeclaration
Objective-C
@interface MMMAnimator : NSObject
Swift
class MMMAnimator : NSObject
-
Sort of a handle returned by MMMAnimator when a new animation is scheduled. Keep it around, otherwise the animation will be cancelled.
See moreDeclaration
Objective-C
@interface MMMAnimationHandle : NSObject
Swift
class MMMAnimationHandle : NSObject
-
Collection view supporting top & bottom shadows.
See moreDeclaration
Objective-C
@interface MMMCollectionView : UICollectionView
Swift
class MMMCollectionView : UICollectionView
-
Auto Layout does not support relationships between empty spaces, so we need to use spacer views and set such constraints between them. This one is a transparent and by default hidden view which can be used as such a spacer. It has no intrinsic size and low content hugging and compression resistance priorities. Unlike UIView we have translatesAutoresizingMaskIntoConstraints set to NO already.
See moreDeclaration
Objective-C
@interface MMMSpacerView : UIView
Swift
class MMMSpacerView : UIView
-
A container which lays out its subviews in certain direction one after another using fixed spacing between them. It also aligns all the items along the layout line according to the given alignment settings. Note that you must use setSubviews: method instead of feeding them one by one via
See moreaddSubview:
. This is kind of aUIStackView
that we understand the internals of.Declaration
Objective-C
@interface MMMStackContainer : UIView
Swift
class MMMStackContainer : UIView
-
Vertical version of MMMStackContainer.
See moreDeclaration
Objective-C
@interface MMMVerticalStackContainer : MMMStackContainer
Swift
class MMMVerticalStackContainer : MMMStackContainer
-
Horizontal version of MMMStackContainer.
See moreDeclaration
Objective-C
@interface MMMHorizontalStackContainer : MMMStackContainer
Swift
class MMMHorizontalStackContainer : MMMStackContainer
-
Wraps a view that uses Auto Layout into a manual layout view providing sizeThatFits: for the outside world. Can be handy with old APIs that do not fully support Auto Layout.
See moreDeclaration
Objective-C
@interface MMMAutoLayoutIsolator : UIView
Swift
class MMMAutoLayoutIsolator : UIView
-
Wraps a view padding it from all the sides.
See moreDeclaration
Objective-C
@interface MMMPaddedView : UIView
Swift
class MMMPaddedView : UIView
-
A view displaying a gradient from top to bottom. The linearity of the gradient can be controlled. Can be handy for shadow overlays, etc.
See moreDeclaration
Objective-C
@interface MMMVerticalGradientView : UIView
Swift
class MMMVerticalGradientView : UIView
-
A base for app-specific stylesheets: commonly used paddings, colors, fonts, etc in a single place.
See moreDeclaration
Objective-C
@interface MMMStylesheet : NSObject
Swift
class MMMStylesheet : NSObject
-
Dimension converter that uses a table of scales.
See moreDeclaration
Objective-C
@interface MMMStylesheetScaleConverter : NSObject <MMMStylesheetConverter>
Swift
class MMMStylesheetScaleConverter : NSObject, MMMStylesheetConverter