我正在尝试在 SwiftUI 中实现,您在一个选项卡上的视图中按下按钮,它会更改为另一个选项卡。我会用 UIKit:
if [condition...button pressed] {
self.tabBarController!.selectedIndex = 2
}
Run Code Online (Sandbox Code Playgroud)
但是在 SwiftUI 中是否有等效的方法来实现这一点?
我正在尝试在 firestore 中组织社交媒体应用程序的数据。为帖子创建一个新集合还是将其放入用户子集合中更好?
深度应该是相同的,但是一种方式比另一种方式有什么优势吗?
创建一个新集合:
帖子(集合)>> user_id(文档)>> userposts(子集合)>> post_id(文档)>> ...
用户(集合)>> [其他用户信息...]
用户中的子集合:
用户(集合)>> user_id(文档)>> userposts(子集合)>> post_id(文档)>> ...
我该如何让它显示从 0 到 9 的所有 x 刻度?
bin diff
1 4 -0.032748
3 9 0.106409
13 7 0.057214
17 3 0.157840
19 0 -0.086567
... ... ...
1941 0 0.014386
1945 4 0.049601
1947 9 0.059406
1957 1 0.045282
1959 6 -0.033853
Run Code Online (Sandbox Code Playgroud)
(
so.Plot(x='bin', y='diff', data=diff_df)
.theme({**axes_style("whitegrid"), "grid.linestyle": ":"})
.add(so.Dots())
.add(so.Range(color='orange'), so.Est())
.add(so.Dot(color='orange'), so.Agg())
.add(so.Line(color='orange'), so.Agg())
.label(
x="Image Similarity Bin", y="Difference",
color=str.capitalize,
)
)
Run Code Online (Sandbox Code Playgroud)
我尝试xticks在 .label 中设置,但它没有执行任何操作。