kyle enhancements
This commit is contained in:
parent
a043cb5eb5
commit
4a5f35820c
@ -21,8 +21,7 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol, ParentMolecule
|
||||
public var link: LinkModel?
|
||||
|
||||
public var children: [MoleculeModelProtocol] {
|
||||
let molecules: [MoleculeModelProtocol?] = [eyebrow, headline, body, link]
|
||||
return molecules.compactMap{ $0 }
|
||||
[eyebrow, headline, body, link].compactMap { (molecule: MoleculeModelProtocol?) in molecule }
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -37,7 +37,7 @@ public extension TemplateProtocol where Self: ViewController {
|
||||
/// Traverses all models and adds any required behavior models.
|
||||
func traverseAndAddRequiredBehaviors() {
|
||||
guard var model = model else { return }
|
||||
let behaviorModels: [PageBehaviorModelProtocol] = model.rootMolecules.reduceDepthFirstTraverse(options: .childFirst, depth: 0, initialResult: []) { (accumulator, molecule, depth) in
|
||||
let behaviorModels: [PageBehaviorModelProtocol] = model.reduceDepthFirstTraverse(options: .childFirst, depth: 0, initialResult: []) { (accumulator, molecule, depth) in
|
||||
if let behaviorRequirer = molecule as? PageBehaviorProtocolRequirer {
|
||||
return accumulator + behaviorRequirer.getRequiredBehaviors()
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ public class PageGetContactBehavior: PageVisibilityBehavior {
|
||||
// Iterate models and provide contact
|
||||
let page = self?.delegate?.moleculeDelegate as? PageProtocol
|
||||
let store = CNContactStore()
|
||||
let consumers: [PageGetContactBehaviorConsumerProtocol] = model.rootMolecules.allMoleculesOfType()
|
||||
let consumers: [PageGetContactBehaviorConsumerProtocol] = model.allMoleculesOfType()
|
||||
for consumer in consumers {
|
||||
guard let parameters = consumer.getMatchParameters(),
|
||||
let contacts = try? store.unifiedContacts(matching: parameters.0, keysToFetch: parameters.1) else { return }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user