mark didselectcell as open
This commit is contained in:
parent
f245d0c321
commit
1a2266af10
@ -241,8 +241,6 @@
|
||||
C695A69423C9909000BFB94E /* DoughnutChartModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69323C9909000BFB94E /* DoughnutChartModel.swift */; };
|
||||
C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69523C990BC00BFB94E /* DoughnutChart.swift */; };
|
||||
C695A69823C990C200BFB94E /* DoughnutChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A69723C990C200BFB94E /* DoughnutChartView.swift */; };
|
||||
C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */; };
|
||||
C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A49210248E180600643D3F /* CarouselItemILC.swift */; };
|
||||
C6FA7D5223C77A4A00A3614A /* UnOrderedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */; };
|
||||
C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */; };
|
||||
C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5123C77A4900A3614A /* NumberedList.swift */; };
|
||||
@ -680,8 +678,6 @@
|
||||
C695A69323C9909000BFB94E /* DoughnutChartModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartModel.swift; sourceTree = "<group>"; };
|
||||
C695A69523C990BC00BFB94E /* DoughnutChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChart.swift; sourceTree = "<group>"; };
|
||||
C695A69723C990C200BFB94E /* DoughnutChartView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DoughnutChartView.swift; sourceTree = "<group>"; };
|
||||
C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILCModel.swift; sourceTree = "<group>"; };
|
||||
C6A49210248E180600643D3F /* CarouselItemILC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemILC.swift; sourceTree = "<group>"; };
|
||||
C6FA7D4F23C77A4700A3614A /* UnOrderedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedList.swift; sourceTree = "<group>"; };
|
||||
C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeStack.swift; sourceTree = "<group>"; };
|
||||
C6FA7D5123C77A4900A3614A /* NumberedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedList.swift; sourceTree = "<group>"; };
|
||||
@ -1288,8 +1284,6 @@
|
||||
D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */,
|
||||
012A88C1238D7BCA00FE3DA1 /* CarouselItemModel.swift */,
|
||||
D21B7F74243BAC8900051ABF /* CarouselItem.swift */,
|
||||
C6A4920E248E17EB00643D3F /* CarouselItemILCModel.swift */,
|
||||
C6A49210248E180600643D3F /* CarouselItemILC.swift */,
|
||||
);
|
||||
path = Items;
|
||||
sourceTree = "<group>";
|
||||
@ -2102,7 +2096,6 @@
|
||||
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
|
||||
D2A92884241ACB25004E01C6 /* ProgrammaticScrollViewController.swift in Sources */,
|
||||
0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */,
|
||||
C6A49211248E180600643D3F /* CarouselItemILC.swift in Sources */,
|
||||
D2E2A99F23E07F8A000B42E6 /* PillButton.swift in Sources */,
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */,
|
||||
@ -2135,7 +2128,6 @@
|
||||
94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */,
|
||||
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||
C6A4920F248E17EB00643D3F /* CarouselItemILCModel.swift in Sources */,
|
||||
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
||||
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
||||
943820842432382400B43AF3 /* WebView.swift in Sources */,
|
||||
|
||||
@ -134,7 +134,6 @@ import Foundation
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: MoleculeCollectionItemModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: CarouselItem.self, viewModelClass: CarouselItemModel.self)
|
||||
MoleculeObjectMapping.shared()?.register(viewClass: CarouselItemILC.self, viewModelClass: CarouselItemILCModel.self)
|
||||
|
||||
|
||||
// Other Container Molecules
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
//
|
||||
// CarouselItemILC.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Murugan, Vimal on 08/06/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers open class CarouselItemILC: CollectionViewCell {
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public let image = LoadImageView(frame: .zero)
|
||||
public let label = Label(frame: .zero)
|
||||
public let caretLink = CaretLink(frame: .zero)
|
||||
public var stack: Stack<StackModel>
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
stack = Stack<StackModel>.createStack(with: [
|
||||
(view: image, model: StackItemModel(horizontalAlignment: .fill)),
|
||||
(view: label, model: StackItemModel(spacing: 6.0, horizontalAlignment: .fill)),
|
||||
(view: caretLink, model: StackItemModel(spacing:52.0, horizontalAlignment: .leading, verticalAlignment: .trailing))],
|
||||
axis: .vertical)
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
public required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
addMolecule(stack)
|
||||
stack.restack()
|
||||
// Make the whole cell focusable.
|
||||
isAccessibilityElement = true
|
||||
caretLink.isAccessibilityElement = false
|
||||
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||
}
|
||||
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let model = model as? CarouselItemILCModel else { return }
|
||||
stack.updateContainedMolecules(with: [model.image, model.label, model.caretLink],
|
||||
delegateObject, additionalData)
|
||||
|
||||
updateAccessibilityLabel()
|
||||
}
|
||||
|
||||
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
guard let action = (model as? CarouselItemILCModel)?.caretLink.action else { return }
|
||||
Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
func updateAccessibilityLabel() {
|
||||
var message = ""
|
||||
if let labelText = label.accessibilityLabel {
|
||||
message += labelText + ", "
|
||||
}
|
||||
|
||||
if let caretLinkText = caretLink.titleLabel?.text {
|
||||
message += caretLinkText
|
||||
}
|
||||
accessibilityLabel = message
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
//
|
||||
// CarouselItemILCModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Murugan, Vimal on 08/06/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class CarouselItemILCModel: ContainerModel, MoleculeModelProtocol, CarouselItemModelProtocol, CollectionItemModelProtocol {
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var image: ImageViewModel
|
||||
public var label: LabelModel
|
||||
public var caretLink: CaretLinkModel
|
||||
|
||||
public class var identifier: String {
|
||||
return "carouselItemILC"
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Keys
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case backgroundColor
|
||||
case label
|
||||
case image
|
||||
case caretLink
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
||||
label = try typeContainer.decode(LabelModel.self, forKey: .label)
|
||||
caretLink = try typeContainer.decode(CaretLinkModel.self, forKey: .caretLink)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(image, forKey: .image)
|
||||
try container.encode(label, forKey: .label)
|
||||
try container.encode(caretLink, forKey: .caretLink)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
}
|
||||
|
||||
}
|
||||
@ -98,7 +98,7 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
||||
}
|
||||
|
||||
// MARK: - Override
|
||||
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
open func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
guard let action = model?.action else { return }
|
||||
Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user