diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m index 4a57aeb7..f7239def 100644 --- a/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Atoms/Views/MVMCoreUICheckBox.m @@ -21,7 +21,7 @@ static const CGFloat FaultTolerance = 20.f; static const CGFloat CheckBoxHeightWidth = 18.0; -@interface MVMCoreUICheckBox () +@interface MVMCoreUICheckBox () @property (nonatomic, readwrite) BOOL isSelected; @property (weak, nonatomic) UIView *checkedSquare; @@ -42,16 +42,24 @@ static const CGFloat CheckBoxHeightWidth = 18.0; @property (nonatomic) BOOL isRequired; @property (nullable, strong, nonatomic) NSString *fieldKey; -@property (nullable, weak) DelegateObject *delegate; +@property (nullable, strong, nonatomic) DelegateObject *delegate; @end @implementation MVMCoreUICheckBox -#pragma mark - convenient class methods +#pragma mark - MVMCoreUIMoleculeViewProtocol + +- (BOOL)needsToBeConstrained { + return YES; +} + +- (UIStackViewAlignment)moleculeAlignment { + return UIStackViewAlignmentLeading; +} - (void)setWithJSON:(NSDictionary *)json delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - + [FormValidator setupValidationWithMolecule:self delegate:((MVMCoreUIDelegateObject *)delegateObject).formValidationProtocol]; self.delegate = delegateObject; self.fieldKey = [json stringForKey:KeyFieldKey]; @@ -70,6 +78,9 @@ static const CGFloat CheckBoxHeightWidth = 18.0; additionalData: additionalData]; } + +#pragma mark - convenient class methods + + (instancetype)mfCheckBox { MVMCoreUICheckBox *checkBox = [[self alloc] initWithFrame:CGRectZero]; checkBox.translatesAutoresizingMaskIntoConstraints = NO; @@ -331,7 +342,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0; [self.checkMark updateCheckSelected:NO animated:animated]; } - FormValidator *formValidator = [FormValidator getFormValidatorForDelegate:((MVMCoreUIDelegateObject *)self.delegate).formValidationProtocol]; + FormValidator *formValidator = ((MVMCoreUIDelegateObject *)self.delegate).formValidationProtocol.formValidatorModel; [formValidator enableByValidation]; } diff --git a/MVMCoreUI/Atoms/Views/ViewConstrainingView.h b/MVMCoreUI/Atoms/Views/ViewConstrainingView.h index 9e1f0316..e4b9e585 100644 --- a/MVMCoreUI/Atoms/Views/ViewConstrainingView.h +++ b/MVMCoreUI/Atoms/Views/ViewConstrainingView.h @@ -44,9 +44,6 @@ // Pins all edges to its super. 0 constant - (void)pinToSuperView; -// Add a view to be constrained in this view. -- (void)addConstrainedView:(nonnull UIView *)view; - // Resets all the constraints to default. - (void)resetConstraints; diff --git a/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift b/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift index afce4d28..63ef182d 100644 --- a/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift +++ b/MVMCoreUI/FormUIHelpers/FormValidationProtocol.swift @@ -22,6 +22,6 @@ import Foundation // The Field name key value pair for sending to server @objc optional func formFieldName() -> String? - // The Feild value key value paid for sending to server - @objc optional func formFieldValue() -> String? + // The Feild value key value pair for sending to server + @objc optional func formFieldValue() -> Any? }