Post

Replies

Boosts

Views

Activity

Reply to Xcode 15 Preview not working with generic nested view
Here the Preview reported error: == PREVIEW UPDATE ERROR: CompileDylibError: Failed to build SampleView.swift Compiling failed: reference to generic type 'NotWorking.InitialView' requires arguments in <...> /Users/giuseppe/Library/Developer/Xcode/DerivedData/MyPlayground-avscbrxoycipyhbsfadustywnrmd/Build/Intermediates.noindex/> Previews/MyPlayground/Intermediates.noindex/MyPlayground.build/Debug-iphonesimulator/MyPlayground.build/Objects-normal/x86_64/> SampleView.1.preview-thunk.swift:35:35: error: reference to generic type 'NotWorking.InitialView' requires arguments in <...> typealias NestedView = NotWorking.InitialView.NestedView ^ <<#S: StringProtocol#>> /Users/giuseppe/Development/Private/Dev/MyPlayground/MyPlayground/SampleView.swift:33:12: note: generic type 'InitialView' > declared here struct InitialView<S>: View where S: StringProtocol { ^ /Users/giuseppe/Library/Developer/Xcode/DerivedData/MyPlayground-avscbrxoycipyhbsfadustywnrmd/Build/Intermediates.noindex/> Previews/MyPlayground/Intermediates.noindex/MyPlayground.build/Debug-iphonesimulator/MyPlayground.build/Objects-normal/x86_64/> SampleView.1.preview-thunk.swift:21:34: error: ambiguous type name 'NestedView' in 'NotWorking.InitialView' extension NotWorking.InitialView.NestedView { ~~~~~~~~~~~~~~~~~~~~~~ ^ /Users/giuseppe/Development/Private/Dev/MyPlayground/MyPlayground/SampleView.swift:38:16: note: found candidate with type > 'NotWorking.InitialView.NestedView' struct NestedView: View { ^ /Users/giuseppe/Library/Developer/Xcode/DerivedData/MyPlayground-avscbrxoycipyhbsfadustywnrmd/Build/Intermediates.noindex/> Previews/MyPlayground/Intermediates.noindex/MyPlayground.build/Debug-iphonesimulator/MyPlayground.build/Objects-normal/x86_64/> SampleView.1.preview-thunk.swift:35:11: note: found candidate with type '<<error type>>' typealias NestedView = NotWorking.InitialView.NestedView ^ /Users/giuseppe/Library/Developer/Xcode/DerivedData/MyPlayground-avscbrxoycipyhbsfadustywnrmd/Build/Intermediates.noindex/> Previews/MyPlayground/Intermediates.noindex/MyPlayground.build/Debug-iphonesimulator/MyPlayground.build/Objects-normal/x86_64/> SampleView.1.preview-thunk.swift:23:47: error: ambiguous type name 'NestedView' in 'NotWorking.InitialView' typealias NestedView = NotWorking.InitialView.NestedView ~~~~~~~~~~~~~~~~~~~~~~ ^ /Users/giuseppe/Development/Private/Dev/MyPlayground/MyPlayground/SampleView.swift:38:16: note: found candidate with type > 'NotWorking.InitialView.NestedView' struct NestedView: View { ^ /Users/giuseppe/Library/Developer/Xcode/DerivedData/MyPlayground-avscbrxoycipyhbsfadustywnrmd/Build/Intermediates.noindex/> Previews/MyPlayground/Intermediates.noindex/MyPlayground.build/Debug-iphonesimulator/MyPlayground.build/Objects-normal/x86_64/> SampleView.1.preview-thunk.swift:35:11: note: found candidate with type '<<error type>>' typealias NestedView = NotWorking.InitialView.NestedView ^
Oct ’23
Reply to Xcode 15 Preview not working with generic nested view
Namespaces (which is not SwiftUI @Namespace property wrapper) in their basic form are a way to group related areas of code in the form of dot separated syntax. The given benefit of that is the capability to distinguish between code blocks that share same name in a different path (e.g. UI.CoordinatorScreen.Fragment vs UI.ScannerScreen.Fragment). This mechanic is naturally enabled when u nest class/struct or enum types in Swift. The problem i mentioned is not related to the fact that nested generic objects doesn't work, because its a fact that it work perfectly when compile and run. The problem is related to a specific behaviour for Xcode preview (not Simulator) where compiler translate the related preview swift code section into an explicit version of the same file using typealias that are not made generic while this is required. For this reason in a second stage of compile it fail. Thx for your reply, but this isn't the answer i'm looking for.
Oct ’23
Reply to Preview Update Error: HumanReadableSwiftError CancellationError: CancellationError()
Ok, it sound like a Voodoo trick, but I always using my iphone device connected to Xcode during my preview (something with cable sometime wireless) . Restarting Xcode didn't work So what i did was: Disconnect my iphone physically from my Mac also turn off wifi. from Xcode i selected Ipad as a new target device After a while Preview started to reload and now it works again.
May ’24