Skip to content

Commit

Permalink
♻️ Update inits for testability
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaatttt committed May 23, 2023
1 parent 0dfc9c8 commit 7e1b097
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions Sources/AppcuesKit/Data/Models/Experience.swift
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,18 @@ extension Experience.Step: Decodable {
type: String,
traits: [Experience.Trait],
actions: [String: [Experience.Action]],
content: ExperienceComponent,
stickyTopContent: ExperienceComponent? = nil,
stickyBottomContent: ExperienceComponent? = nil
content: ExperienceComponent
) {
self.id = id
self.type = type
self.traits = traits
self.actions = actions
self.content = content
self.stickyTopContent = stickyTopContent
self.stickyBottomContent = stickyBottomContent

let (bodyComponent, stickyTopComponent, stickyBottomComponent) = content.divided()

self.content = bodyComponent
self.stickyTopContent = stickyTopComponent
self.stickyBottomContent = stickyBottomComponent
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import SwiftUI

@available(iOS 13.0, *)
internal struct ImageCacheKey: EnvironmentKey {
static let defaultValue = SessionImageCache()
// This is mutable so a custom cache can be injected for testing.
static var defaultValue = SessionImageCache()
}

@available(iOS 13.0, *)
Expand Down

0 comments on commit 7e1b097

Please sign in to comment.