-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏗 Refactor ExperienceRenderer to support multiple ExperienceStateMach…
…ine instances for non-modal Experiences There is one sharedStateMachine for modal experiences and a mapping by experience ID to state machine for non-modal.
- Loading branch information
Showing
20 changed files
with
288 additions
and
77 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Sources/AppcuesKit/Data/Extensions/Collection+Custom.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// Collection+Custom.swift | ||
// AppcuesKit | ||
// | ||
// Created by Matt on 2022-04-28. | ||
// Copyright © 2022 Appcues. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Collection { | ||
func separate(predicate: (Iterator.Element) -> Bool) -> (matching: [Iterator.Element], notMatching: [Iterator.Element]) { | ||
var separated: ([Iterator.Element], [Iterator.Element]) = ([], []) | ||
for element in self { | ||
if predicate(element) { | ||
separated.0.append(element) | ||
} else { | ||
separated.1.append(element) | ||
} | ||
} | ||
return separated | ||
} | ||
|
||
subscript (safe index: Index) -> Element? { | ||
return indices.contains(index) ? self[index] : nil | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
Sources/AppcuesKit/Data/Extensions/Collection+SafeIndex.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.