Merge branch 'develop' into feature/heart

This commit is contained in:
Lekshmi S 2020-09-14 15:22:27 +05:30
commit f3f71cbb38
8 changed files with 54 additions and 12 deletions

View File

@ -140,7 +140,7 @@ open class CaretView: View {
caretPath.addLine(to: CGPoint(x: frame.size.width - inset, y: frame.size.height - inset))
}
enabledColor.setStroke()
_ = isEnabled ? enabledColor.setStroke() : disabledColor.setStroke()
caretPath.stroke()
}
@ -160,6 +160,7 @@ open class CaretView: View {
isHidden = false
backgroundColor = .clear
enabledColor = .mvmBlack
disabledColor = .mvmCoolGray3
}
/// Ensure you have defined a CaretSize with Orientation before calling.

View File

@ -21,6 +21,7 @@ import Foundation
public var contentMode: UIView.ContentMode?
public var localBundle: Bundle?
public var cornerRadius: CGFloat?
public var clipsImage: Bool?
public init(image: String, imageFormat: String? = nil, width: CGFloat? = nil, height: CGFloat? = nil) {
self.image = image
@ -40,5 +41,6 @@ import Foundation
case height
case contentMode
case cornerRadius
case clipsImage
}
}

View File

@ -254,6 +254,10 @@ import UIKit
clipsToBounds = true
layer.cornerRadius = cornerRadius
}
if let clipsImage = imageModel.clipsImage {
clipsToBounds = clipsImage
}
}
// MARK: - load functions

View File

@ -9,12 +9,21 @@
import UIKit
class AccordionListItemModel: MoleculeListItemModel {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
override public class var identifier: String {
return "accordionListItem"
}
}
public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]
public var hideLineWhenExpanded: Bool = false
//--------------------------------------------------
// MARK: - Keys
//--------------------------------------------------
private enum CodingKeys: String, CodingKey {
case moleculeName
case molecules
@ -22,11 +31,19 @@ class AccordionListItemModel: MoleculeListItemModel {
case hideLineWhenExpanded
}
//--------------------------------------------------
// MARK: - Methods
//--------------------------------------------------
public override func setDefaults() {
super.setDefaults()
hideArrow = true
}
//--------------------------------------------------
// MARK: - Codec
//--------------------------------------------------
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
molecules = try typeContainer.decodeModels(codingKey: .molecules)

View File

@ -8,20 +8,29 @@
import UIKit
@objcMembers public class AccordionMoleculeTableViewCell: MoleculeTableViewCell {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
var accordionListItemModel: AccordionListItemModel? {
return listItemModel as? AccordionListItemModel
}
let accordionButton = createAccordionButton()
static func createAccordionButton() -> Button {
let accordionButton: Button = {
let accordionButton = Button(type: .custom)
accordionButton.setTitle("+", for: .normal)
accordionButton.setTitleColor(.black, for: .normal)
accordionButton.titleLabel?.font = UIFont.systemFont(ofSize: 40, weight: .ultraLight)
accordionButton.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
accordionButton.translatesAutoresizingMaskIntoConstraints = true
return accordionButton
}
}()
//--------------------------------------------------
// MARK: - Setup
//--------------------------------------------------
override public func setupView() {
customAccessoryView = true
@ -29,11 +38,13 @@ import UIKit
accessoryView = accordionButton
}
override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
accordionButton.isSelected = !accordionButton.isSelected
override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
accordionButton.isSelected.toggle()
accordionButton.setTitle(accordionButton.isSelected ? "-" : "+", for: .normal)
guard let model = accordionListItemModel else { return }
if accordionButton.isSelected {
if let indexPath = delegateObject?.moleculeDelegate?.getIndexPath(for: model) {
delegateObject?.moleculeDelegate?.addMolecules(model.molecules, indexPath: indexPath, animation: .automatic)

View File

@ -10,7 +10,7 @@ import Foundation
open class BGImageMolecule: MoleculeContainer {
let image = LoadImageView(pinnedEdges: .all)
public let image = LoadImageView(pinnedEdges: .all)
open override func setupView() {
super.setupView()

View File

@ -9,7 +9,7 @@
import Foundation
open class BGImageMoleculeModel: MoleculeContainerModel {
public override class var identifier: String {
open override class var identifier: String {
return "bgImageContainer"
}
public var image: ImageViewModel
@ -44,7 +44,7 @@ open class BGImageMoleculeModel: MoleculeContainerModel {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
open override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(image, forKey: .image)

View File

@ -8,8 +8,12 @@
import UIKit
@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol {
@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol {
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
open var molecule: MoleculeViewProtocol?
open var listItemModel: ListItemModelProtocol?
public let containerHelper = ContainerHelper()
@ -30,7 +34,10 @@ import UIKit
private var initialSetupPerformed = false
//--------------------------------------------------
// MARK: - Styling
//--------------------------------------------------
open func styleLine(with style: ListItemStyle?) {
switch style {
case .standard?: