diff --git a/Example/PreFireExample.xcodeproj/project.pbxproj b/Example/PreFireExample.xcodeproj/project.pbxproj index 3e7fdc0..35914cb 100644 --- a/Example/PreFireExample.xcodeproj/project.pbxproj +++ b/Example/PreFireExample.xcodeproj/project.pbxproj @@ -341,6 +341,7 @@ ONLY_ACTIVE_ARCH = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -395,6 +396,7 @@ MTL_FAST_MATH = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -423,7 +425,7 @@ PRODUCT_NAME = PrefireExample; SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -453,7 +455,7 @@ PRODUCT_NAME = PrefireExample; SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = 1; VALIDATE_PRODUCT = YES; }; @@ -480,7 +482,7 @@ SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = NO; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PrefireExample.app/PrefireExample"; }; @@ -506,7 +508,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PrefireExample.app/PrefireExample"; VALIDATE_PRODUCT = YES; diff --git a/Sources/Prefire/Playbook/PlaybookView.swift b/Sources/Prefire/Playbook/PlaybookView.swift index b5602bc..df354fd 100644 --- a/Sources/Prefire/Playbook/PlaybookView.swift +++ b/Sources/Prefire/Playbook/PlaybookView.swift @@ -139,16 +139,20 @@ public struct PlaybookView: View { viewModel.renderTime = loadingTime }) .onPreferenceChange(UserStoryPreferenceKey.self) { userStory in - guard viewModel.story != userStory else { return } - viewModel.story = userStory + Task { @MainActor in + guard viewModel.story != userStory else { return } + viewModel.story = userStory - if !isComponent { - sectionNames = viewModels.compactMap { $0.story }.uniqued() + if !isComponent { + sectionNames = viewModels.compactMap { $0.story }.uniqued() + } } } .onPreferenceChange(StatePreferenceKey.self) { state in - guard viewModel.state != state else { return } - viewModel.state = state + Task { @MainActor in + guard viewModel.state != state else { return } + viewModel.state = state + } } Divider()