sebj / swiftui-matched-inline-title

Transition from any SwiftUI Text view into an inline navigation bar title when the view is scrolled off-screen, as seen in Apple's TV & TestFlight iOS apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Still working?

vectorstofinal opened this issue · comments

Discussed in #1

Originally posted by vectorstofinal June 13, 2022
This package seems right up my alley but might not be working with latest xcode (14 beta 1). Seems previews won't compile with this code in the file. And while the code will compile and run in the sim it does not seem to ever fill in the navbar title.

Here's the error from Preview:

LinkDylibError: Failed to build RecipeDetailView.swift

Linking failed: linker command failed with exit code 1 (use -v to see invocation)

ld: warning: directory not found for option '-F/Applications/Xcode.app/Contents/SharedFrameworks-iphonesimulator'
Undefined symbols for architecture arm64:
"nominal type descriptor for MatchedInlineTitle.MatchedTitle", referenced from:
_symbolic _____y_____y_____yABy_____y_____G______y__________GAFyAAyABy______AAy_____ySay_____GAlFy_____AHGGGtGGAHGtG_Qo_______tGG 7SwiftUI6VStackV AA9TupleViewV AA06ScrollE0V18MatchedInlineTitleE07matchedhI02inQrAA9NamespaceV2IDV_tFQO AH0gI0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderE0V AA14_PaddingLayoutV AU07SectionU0V AA7ForEachV AU0sE8ModelRowC AU0s3RowE0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic ____y_____y_____y_____yABy_____y_____G______y__________GAFyAAyABy______AAy_____ySay_____GAlFy_____AHGGGtGGAHGtG_Qo_______tGG______Qo 7SwiftUI4ViewPAAE5sheet11isPresented9onDismiss7contentQrAA7BindingVySbG_yycSgqd__yctAaBRd__lFQO AA6VStackV AA05TupleC0V AA06ScrollC0V18MatchedInlineTitleE07matchedoP02inQrAA9NamespaceV2IDV_tFQO AR0nP0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderC0V AA14_PaddingLayoutV A3_13SectionHeaderV AA7ForEachV A3_0zC8ModelRowC A3_0z3RowC0V AA6SpacerV A3_0Z6RunnerV in RecipeDetailView.1.preview-thunk.o
_symbolic _____y_____yAAy_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG_Qo_______tG 7SwiftUI9TupleViewV AA06ScrollD0V18MatchedInlineTitleE07matchedgH02inQrAA9NamespaceV2IDV_tFQO AF0fH0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AS07SectionT0V AA7ForEachV AS0rD8ModelRowC AS0r3RowD0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic _____y___________y_____yACy_____y_____G______y__________GAGy_____yACy______AKy_____ySay_____GAnGy_____AIGGGtGGAIGtG_Qo_______tGG 7SwiftUI13_VariadicViewO4TreeV AA13_VStackLayoutV AA05TupleD0V AA06ScrollD0V18MatchedInlineTitleE07matchedkL02inQrAA9NamespaceV2IDV_tFQO AL0jL0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA08_PaddingG0V AA0F0V AY07SectionX0V AA7ForEachV AY0vD8ModelRowC AY0v3RowD0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic ____y_____y_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG_Qo 7SwiftUI10ScrollViewV18MatchedInlineTitleE07matchedfG02inQrAA9NamespaceV2IDV_tFQO AA05TupleD0V AD0eG0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AS07SectionT0V AA7ForEachV AS0rD8ModelRowC AS0r3RowD0V in RecipeDetailView.1.preview-thunk.o
_symbolic _____y_____y_____y_____G______y__________GAFy_____yABy______AJy_____ySay_____GAmFy_____AHGGGtGGAHGtGG 7SwiftUI10ScrollViewV AA05TupleD0V 18MatchedInlineTitle0fH0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AM07SectionP0V AA7ForEachV AM0nD8ModelRowC AM0nxD0V in RecipeDetailView.1.preview-thunk.o
symbolic _____y_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG 7SwiftUI9TupleViewV 18MatchedInlineTitle0eG0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AK07SectionO0V AA7ForEachV AK0mD8ModelRowC AK0mwD0V in RecipeDetailView.1.preview-thunk.o
...
"MatchedInlineTitle.MatchedTitle.init(
: A1, namespace: SwiftUI.Namespace.ID, _: (SwiftUI.Text) -> A) -> MatchedInlineTitle.MatchedTitle", referenced from:
closure #1 () -> SwiftUI.TupleView<(MatchedInlineTitle.MatchedTitle<SwiftUI.Text>, <<opaque return type of (extension in SwiftUI):SwiftUI.View.padding(SwiftUI.Edge.Set, CoreGraphics.CGFloat?) -> some>>.0, <<opaque return type of (extension in SwiftUI):SwiftUI.View.padding(SwiftUI.EdgeInsets) -> some>>.0)> in closure #1 () -> SwiftUI.TupleView<(<<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>.0, SwiftUI.Spacer)> in (extension in Vector_Bar_PreviewReplacement_RecipeDetailView_1):Vector_Bar.RecipeDetailView.(__preview__body in _3822F86EE8E0F1FBA7FC1F27008258AC).getter : some in RecipeDetailView.1.preview-thunk.o
"protocol conformance descriptor for MatchedInlineTitle.MatchedTitle : SwiftUI.View in MatchedInlineTitle", referenced from:
lazy protocol witness table accessor for type MatchedInlineTitle.MatchedTitle<SwiftUI.Text> and conformance MatchedInlineTitle.MatchedTitle : SwiftUI.View in MatchedInlineTitle in RecipeDetailView.1.preview-thunk.o
"(extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some", referenced from:
closure #1 () -> SwiftUI.TupleView<(<<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>.0, SwiftUI.Spacer)> in (extension in Vector_Bar_PreviewReplacement_RecipeDetailView_1):Vector_Bar.RecipeDetailView.(__preview__body in _3822F86EE8E0F1FBA7FC1F27008258AC).getter : some in RecipeDetailView.1.preview-thunk.o
(maybe you meant: demangling cache variable for type metadata for (<<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>.0, SwiftUI.Spacer), demangling cache variable for type metadata for <<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>.0 )
"opaque type descriptor for <<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>", referenced from:
_symbolic _____y_____y_____yABy_____y_____G______y__________GAFyAAyABy______AAy_____ySay_____GAlFy_____AHGGGtGGAHGtG_Qo_______tGG 7SwiftUI6VStackV AA9TupleViewV AA06ScrollE0V18MatchedInlineTitleE07matchedhI02inQrAA9NamespaceV2IDV_tFQO AH0gI0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderE0V AA14_PaddingLayoutV AU07SectionU0V AA7ForEachV AU0sE8ModelRowC AU0s3RowE0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic ____y_____y_____y_____yABy_____y_____G______y__________GAFyAAyABy______AAy_____ySay_____GAlFy_____AHGGGtGGAHGtG_Qo_______tGG______Qo 7SwiftUI4ViewPAAE5sheet11isPresented9onDismiss7contentQrAA7BindingVySbG_yycSgqd__yctAaBRd__lFQO AA6VStackV AA05TupleC0V AA06ScrollC0V18MatchedInlineTitleE07matchedoP02inQrAA9NamespaceV2IDV_tFQO AR0nP0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderC0V AA14_PaddingLayoutV A3_13SectionHeaderV AA7ForEachV A3_0zC8ModelRowC A3_0z3RowC0V AA6SpacerV A3_0Z6RunnerV in RecipeDetailView.1.preview-thunk.o
_symbolic _____y_____yAAy_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG_Qo_______tG 7SwiftUI9TupleViewV AA06ScrollD0V18MatchedInlineTitleE07matchedgH02inQrAA9NamespaceV2IDV_tFQO AF0fH0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AS07SectionT0V AA7ForEachV AS0rD8ModelRowC AS0r3RowD0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic _____y___________y_____yACy_____y_____G______y__________GAGy_____yACy______AKy_____ySay_____GAnGy_____AIGGGtGGAIGtG_Qo_______tGG 7SwiftUI13_VariadicViewO4TreeV AA13_VStackLayoutV AA05TupleD0V AA06ScrollD0V18MatchedInlineTitleE07matchedkL02inQrAA9NamespaceV2IDV_tFQO AL0jL0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA08_PaddingG0V AA0F0V AY07SectionX0V AA7ForEachV AY0vD8ModelRowC AY0v3RowD0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
_symbolic ____y_____y_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG_Qo 7SwiftUI10ScrollViewV18MatchedInlineTitleE07matchedfG02inQrAA9NamespaceV2IDV_tFQO AA05TupleD0V AD0eG0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AS07SectionT0V AA7ForEachV AS0rD8ModelRowC AS0r3RowD0V in RecipeDetailView.1.preview-thunk.o
_symbolic _____y_____y_____y_____G______y__________GAEy_____yAAy______AIy_____ySay_____GAlEy_____AGGGGtGGAGGtG_Qo_______t 7SwiftUI10ScrollViewV18MatchedInlineTitleE07matchedfG02inQrAA9NamespaceV2IDV_tFQO AA05TupleD0V AD0eG0V AA4TextV AA15ModifiedContentV 10Vector_Bar018RecipeDetailHeaderD0V AA14_PaddingLayoutV AA6VStackV AS07SectionT0V AA7ForEachV AS0rD8ModelRowC AS0r3RowD0V AA6SpacerV in RecipeDetailView.1.preview-thunk.o
"opaque type descriptor accessor for <<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>", referenced from:
closure #1 () -> SwiftUI.TupleView<(<<opaque return type of (extension in MatchedInlineTitle):SwiftUI.ScrollView.matchedInlineTitle(in: SwiftUI.Namespace.ID) -> some>>.0, SwiftUI.Spacer)> in (extension in Vector_Bar_PreviewReplacement_RecipeDetailView_1):Vector_Bar.RecipeDetailView.(__preview__body in _3822F86EE8E0F1FBA7FC1F27008258AC).getter : some in RecipeDetailView.1.preview-thunk.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Hi!

I've just created a very simple test project (using the code snippet from this README), and found this worked still using Xcode 13.4.1 on iOS 15.5.

The same project required a change when running with Xcode 14 on iOS 16 – had to add the modifier .toolbar(.visible, in: .navigationBar) following after .matchedInlineTitle(in: namespace), but only because my test project had no other items in its toolbar, and iOS 16 release notes state that 'If a navigation bar has no title, toolbar items, or search content, it’s automatically hidden'.

I can't speak for the error, as I don't think testing against early developer betas of Xcode or iOS is particularly helpful given they're likely to be very buggy and not stable until much later in the year, closer to release. One of the Xcode projects I work on currently won't build at all due to a spurious Xcode 14 error, for which I've filed feedback with Apple.