diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItem.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItem.swift index f6054ebb..2b5c05f3 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItem.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItem.swift @@ -71,7 +71,7 @@ open class RadioSwatchItem: Control { //Draw the strikethrough strikeLayer?.removeFromSuperlayer() if isOutOfStock { - let line = getStrikeThrough(color: UIColor.mvmCoolGray6, thickness: 1) + let line = getStrikeThrough(color: UIColor.mvmBlack, thickness: 1) layer.addSublayer(line) strikeLayer = line } @@ -79,7 +79,7 @@ open class RadioSwatchItem: Control { //Draw the selected layer selectedLayer?.removeFromSuperlayer() if isSelected { - let outerCircle = getSelectedLayer(color: UIColor.black, thickness: 1) + let outerCircle = getSelectedLayer(color: UIColor.mvmBlack, thickness: 1) layer.addSublayer(outerCircle) selectedLayer = outerCircle bottomText.isHidden = false @@ -121,7 +121,7 @@ open class RadioSwatchItem: Control { circle.fillColor = fillColor.cgColor circle.opacity = 1.0 circle.lineWidth = thickness - circle.strokeColor = isEnabled ? color.cgColor : UIColor.mvmCoolGray6.cgColor + circle.strokeColor = isSelected ? color.cgColor : UIColor.mvmCoolGray6.cgColor let circlePath = UIBezierPath(ovalIn: CGRect(x: 12, y: 1, width: 30, height: 30)) circle.path = circlePath.cgPath @@ -134,7 +134,7 @@ open class RadioSwatchItem: Control { strikeThrough.fillColor = nil strikeThrough.opacity = 1.0 strikeThrough.lineWidth = thickness - strikeThrough.strokeColor = color.cgColor + strikeThrough.strokeColor = isSelected ? color.cgColor : UIColor.mvmCoolGray6.cgColor let linePath = UIBezierPath() linePath.move(to: CGPoint(x: 12, y: 30)) diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItemCollectionViewCell.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItemCollectionViewCell.swift index b274d28d..3d3100a8 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItemCollectionViewCell.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatchItemCollectionViewCell.swift @@ -19,6 +19,5 @@ open class RadioSwatchItemCollectionViewCell: CollectionViewCell { open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let model = model as? RadioSwatchItemModel else { return } radioSwatch.set(with: model, delegateObject, additionalData) - self.isUserInteractionEnabled = model.enabled ?? true } } diff --git a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatches.swift b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatches.swift index d73c749a..ed16fc39 100644 --- a/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatches.swift +++ b/MVMCoreUI/Atomic/Atoms/Selectors/RadioSwatches.swift @@ -114,6 +114,11 @@ extension RadioSwatches: UICollectionViewDataSource { return swatches?.count ?? 0 } + public func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool { + guard let molecule = swatches?[indexPath.row] else {return true } + return molecule.enabled ?? true + } + open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { guard let molecule = swatches?[indexPath.row], let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RadioSwatchItemCollectionViewCell", for: indexPath) as? RadioSwatchItemCollectionViewCell else { fatalError()