Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Added doc comments to LayoutKit Objective-C API C
Browse files Browse the repository at this point in the history
    - Added doc comments on all LayoutKit API wrappers.
    - Added doc comments on all LayoutKit API builder objects.
  • Loading branch information
li-svartak authored and pa1-linkedin committed Jun 11, 2019
1 parent 642d828 commit c874993
Show file tree
Hide file tree
Showing 23 changed files with 897 additions and 4 deletions.
51 changes: 51 additions & 0 deletions Sources/ObjCSupport/Builders/LOKButtonLayoutBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,76 @@ typedef NS_CLOSED_ENUM(NSInteger, LOKButtonLayoutType) {
LOKButtonLayoutTypeContactAdd
};

/**
A layout builder for @c LOKButtonLayout.
*/
@interface LOKButtonLayoutBuilder: NSObject<LOKLayoutBuilder>

/**
Creates a @c LOKButtonLayoutBuilder with the given title.
@param title The button title.
*/
- (nonnull instancetype)initWithTitle:(nullable NSString *)title;
+ (nonnull instancetype)withTitle:(nullable NSString *)title;

/**
@c LOKButtonLayoutBuilder block for setting the button type of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^type)(LOKButtonLayoutType);

/**
@c LOKButtonLayoutBuilder block for setting title font of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^font)(UIFont * _Nullable);

/**
@c LOKButtonLayoutBuilder block for setting button image of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^image)(UIImage * _Nullable);

/**
@c LOKButtonLayoutBuilder block for setting image size of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^imageSize)(CGSize);

/**
@c LOKButtonLayoutBuilder block for setting edge inset of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^contentEdgeInsets)(NSValue * _Nullable);

/**
@c LOKButtonLayoutBuilder block for defining how this layout is positioned inside its parent layout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^alignment)(LOKAlignment * _Nullable);

/**
@c LOKButtonLayoutBuilder block for setting flexibility of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^flexibility)(LOKFlexibility * _Nullable);

/**
@c LOKButtonLayoutBuilder block for setting the viewReuseId used by LayoutKit.
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^viewReuseId)(NSString * _Nullable);

/**
@c LOKButtonLayoutBuilder block for setting the view class of the @c LOKButtonLayout (should be @c UIButton or subclass).
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^viewClass)(Class _Nullable);

/**
Layoutkit configuration block called with the created @c UIButton (or subclass).
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayoutBuilder * _Nonnull(^config)( void(^ _Nullable)(UIButton *_Nonnull));

/**
@c LOKButtonLayoutBuilder block for setting edge insets (positive) of the @c LOKButtonLayout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^insets)(LOKEdgeInsets);

/**
Calling this builds and returns the @c LOKButtonLayout
*/
@property (nonatomic, nonnull, readonly) LOKButtonLayout *layout;

@end
34 changes: 33 additions & 1 deletion Sources/ObjCSupport/Builders/LOKInsetLayoutBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,52 @@
#import "LOKLayoutBuilder.h"

@class LOKInsetLayout;

/**
A layout builder for @c LOKInsetLayout.
*/
@interface LOKInsetLayoutBuilder: NSObject<LOKLayoutBuilder>

/**
Creates a @c LOKInsetLayoutBuilder with the given insets and sublayout.
@param insets The @c LOKEdgeInsets for layout.
@param sublayout The layout placed inside the @c LOKInsetLayout.
*/
- (nonnull instancetype)initWithInsets:(LOKEdgeInsets)insets around:(nonnull id<LOKLayout>)sublayout;
+ (nonnull instancetype)withInsets:(LOKEdgeInsets)insets around:(nonnull id<LOKLayout>)sublayout;

/**
@c LOKInsetLayoutBuilder block for defining how this layout is positioned inside its parent layout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^alignment)(LOKAlignment * _Nullable);

/**
@c LOKInsetLayoutBuilder block for setting flexibility of the @c LOKInsetLayout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^flexibility)(LOKFlexibility * _Nullable);

/**
@c LOKInsetLayoutBuilder block for setting the viewReuseId used by LayoutKit.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^viewReuseId)(NSString * _Nullable);

/**
@c LOKInsetLayoutBuilder block for setting the view class for the @c LOKInsetLayout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^viewClass)(Class _Nullable);

/**
Layoutkit configuration block called with created @c LOKView.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^config)( void(^ _Nullable)(LOKView *_Nonnull));

/**
@c LOKInsetLayoutBuilder block for setting edge inset for the @c LOKInsetLayout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^insets)(LOKEdgeInsets);

/**
Calling this builds and returns the @c LOKInsetLayout
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayout *layout;

@end
48 changes: 48 additions & 0 deletions Sources/ObjCSupport/Builders/LOKLabelLayoutBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,74 @@

@class LOKLabelLayout;

/**
Layout builder for a @c LOKLabelLayout.
*/
@interface LOKLabelLayoutBuilder: NSObject<LOKLayoutBuilder>

/**
Creates a @c LOKLabelLayoutBuilder with the given string.
@param string The string to be used for label.
*/
- (nonnull instancetype)initWithString:(nullable NSString *)string;

/**
Creates a @c LOKLabelLayoutBuilder with the given attributed string.
@param attributedString The attributed string to set as the attributedText.
*/
- (nonnull instancetype)initWithAttributedString:(nullable NSAttributedString *)attributedString;

+ (nonnull instancetype)withString:(nullable NSString *)string;
+ (nonnull instancetype)withAttributedString:(nullable NSAttributedString *)attributedString;

/**
@c LOKLabelLayoutBuilder block for setting font of the @c LOKLabelLayout.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^font)(UIFont * _Nullable);

/**
@c LOKLabelLayoutBuilder block for setting the number of lines the label can have.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^numberOfLines)(NSInteger);

/**
@c LOKLabelLayoutBuilder block for setting line height of the label.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^lineHeight)(CGFloat);

/**
@c LOKLabelLayoutBuilder block for defining how this layout is positioned inside its parent layout.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^alignment)(LOKAlignment * _Nullable);

/**
@c LOKLabelLayoutBuilder block for setting flexibility of the @c LOKLabelLayout.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^flexibility)(LOKFlexibility * _Nullable);

/**
@c LOKLabelLayoutBuilder block for setting the viewReuseId used by LayoutKit.
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^viewReuseId)(NSString * _Nullable);

/**
@c LOKLabelLayoutBuilder block for setting the view class of the @c LOKLabelLayout (should be UILabel or subclass).
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^viewClass)(Class _Nullable);

/**
Layoutkit configuration block called with the created @c UILabel (or subclass).
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayoutBuilder * _Nonnull(^config)( void(^ _Nullable)(UILabel *_Nonnull));

/**
@c LOKLabelLayoutBuilder block for setting edge insets (positive) for the layout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^insets)(LOKEdgeInsets);

/**
Calling this builds and returns the @c LOKLabelLayout
*/
@property (nonatomic, nonnull, readonly) LOKLabelLayout *layout;

@end
39 changes: 39 additions & 0 deletions Sources/ObjCSupport/Builders/LOKOverlayLayoutBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,61 @@

@class LOKOverlayLayout;

/**
Builder for @c LOKOverlayLayout class.
*/
@interface LOKOverlayLayoutBuilder: NSObject<LOKLayoutBuilder>

/**
Creates a @c LOKOverlayLayoutBuilder with the given collection of primary layouts.
@param primaryLayouts The collection of layouts used inside the @c LOKOverlayLayout.
*/
- (nonnull instancetype)initWithPrimaryLayouts:(nonnull NSArray< id<LOKLayout> > *)primaryLayouts;
+ (nonnull instancetype)withPrimaryLayouts:(nonnull NSArray< id<LOKLayout> > *)primaryLayouts;

/**
The layouts to put in front of the primary layout. They will be at most as large as the primary layout.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^overlay)(NSArray< id<LOKLayout> > * _Nullable);

/**
The layouts to put behind the primary layout. They will be at most as large as the primary layout.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^background)(NSArray< id<LOKLayout> > * _Nullable);

/**
@c LOKOverlayLayoutBuilder block for defining how this layout is positioned inside its parent layout.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^alignment)(LOKAlignment * _Nullable);

/**
@c LOKOverlayLayoutBuilder block for setting flexibility of the @c LOKOverlayLayout.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^flexibility)(LOKFlexibility * _Nullable);

/**
@c LOKOverlayLayoutBuilder block for setting the viewReuseId used by LayoutKit.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^viewReuseId)(NSString * _Nullable);

/**
@c LOKOverlayLayoutBuilder block for setting the view class of the @c LOKOverlayLayout.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^viewClass)(Class _Nullable);

/**
Layoutkit configuration block called with the created @c LOKView.
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayoutBuilder * _Nonnull(^config)( void(^ _Nullable)(LOKView *_Nonnull));

/**
@c LOKOverlayLayoutBuilder block for setting edge inset (positive) for the layout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^insets)(LOKEdgeInsets);

/**
Calling this builds and returns the @c LOKOverlayLayout
*/
@property (nonatomic, nonnull, readonly) LOKOverlayLayout *layout;

@end
56 changes: 55 additions & 1 deletion Sources/ObjCSupport/Builders/LOKSizeLayoutBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,81 @@
#import "LOKLayoutBuilder.h"

@class LOKSizeLayout;

/**
A layout builder for @c LOKSizeLayout.
*/
@interface LOKSizeLayoutBuilder: NSObject<LOKLayoutBuilder>

/**
Creates a @c LOKSizeLayoutBuilder with the given sublayout.
@param sublayout The layout for which size layout is being created.
*/
- (nonnull instancetype)initWithSublayout:(nullable id<LOKLayout>)sublayout;
+ (nonnull instancetype)withSublayout:(nullable id<LOKLayout>)sublayout;

/**
@c LOKSizeLayoutBuilder block for setting width of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^width)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for setting height of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^height)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for setting the minimum width of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^minWidth)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for setting minimum height of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^minHeight)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for setting maximum width of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^maxWidth)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for setting maximum height of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^maxHeight)(CGFloat);

/**
@c LOKSizeLayoutBuilder block for defining how this layout is positioned inside its parent layout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^alignment)(LOKAlignment * _Nullable);

/**
@c LOKSizeLayoutBuilder block for setting flexibility of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^flexibility)(LOKFlexibility * _Nullable);

/**
@c LOKSizeLayoutBuilder block for setting the viewReuseId used by LayoutKit.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^viewReuseId)(NSString * _Nullable);

/**
@c LOKSizeLayoutBuilder block for setting the view class of the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^viewClass)(Class _Nullable);

/**
Layoutkit configuration block called with the created @c LOKView.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayoutBuilder * _Nonnull(^config)( void(^ _Nullable)(LOKView *_Nonnull));

/**
@c LOKSizeLayoutBuilder block for setting edge inset (positive) for the layout.
*/
@property (nonatomic, nonnull, readonly) LOKInsetLayoutBuilder * _Nonnull(^insets)(LOKEdgeInsets);

/**
Calling this builds and returns the @c LOKSizeLayout.
*/
@property (nonatomic, nonnull, readonly) LOKSizeLayout *layout;

@end
Loading

0 comments on commit c874993

Please sign in to comment.