swiftui-bug

SwiftUI - Navigation bar title not displayed when nesting TabView in NavigationView

≯℡__Kan透↙ 提交于 2020-08-08 05:15:19
问题 Due to application specific reasons I have to nest a TabView in a NavigationView. But then the navigation bar title of the tab items doesn't get displayed, just an empty navigation bar. Any solutions to this? struct ContentView: View { var body: some View { NavigationView { TabView { Text("Tab 1") .navigationBarTitle("Tab 1") // is ignored, only an empty string is displayed .tabItem { Text("Tab 1") } Text("Tab 2") .navigationBarTitle("Tab 2") // is ignored, only an empty string is displayed

SwiftUI Nested ForEach causes unexpected ordering

馋奶兔 提交于 2020-08-07 05:06:16
问题 I am using two ForEach() in a nested way, one to display the sections, and the other to display the individual cells of the List view. My problem is that the iterator variable from the first ForEach is behaving in a very weird way when accessing it in the second ForEach . In this gif I attached, the first variable behind Round ( ri in the code snippet below) changes its value sometimes when I scroll up or down. However the value of this variable is always the same inside the first ForEach ,

SwiftUI Nested ForEach causes unexpected ordering

若如初见. 提交于 2020-08-07 05:06:04
问题 I am using two ForEach() in a nested way, one to display the sections, and the other to display the individual cells of the List view. My problem is that the iterator variable from the first ForEach is behaving in a very weird way when accessing it in the second ForEach . In this gif I attached, the first variable behind Round ( ri in the code snippet below) changes its value sometimes when I scroll up or down. However the value of this variable is always the same inside the first ForEach ,

SwiftUI TabView with List not refreshing after objected deleted from / added to Core Data

谁都会走 提交于 2020-07-08 00:34:03
问题 Description: When an object in a list (created from a fetchrequest) is deleted from a context, and the context is saved, the list does not properly update. Error: Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value (Thrown on line 5 below) struct DetailView: View { @ObservedObject var event: Event var body: some View { Text("\(event.timestamp!, formatter: dateFormatter)") .navigationBarTitle(Text("Detail")) } } Steps to reproduce: Create a new Master Detail App

SwiftUI deep linking with NavigationLink inside List onAppear with tag: and selection: doesn't activate link

你。 提交于 2020-06-29 04:30:07
问题 Trying to build deep linking into a list of NavigationList items; I will be reading a value on the SwiftUI view's .onAppear and based on that value, navigate to a specific cell. There are three issues that come up with different setups I have tried: (1) with the below code, navigation doesn't happen at all, (2) if it does navigate, it will immediately pop back, (3) if programmatic navigation works and it doesn't pop back, the manual navigation doesn't work. I have tried this with a Binding

SwiftUI NavigationLink programmatic navigation inside onAppear immediately navigates back/pops the view when using a dictionary [String:Binding<Bool>]

白昼怎懂夜的黑 提交于 2020-06-23 11:23:27
问题 I want to programmatically be able to navigate to a link within a List of NavigationLinks when the view appears (building deep linking from push notification). I have a string -> Bool dictionary which is bound to a custom Binding<Bool> inside my view. When the view appears, I set the bool property, navigation happens, however, it immediately pops back. I followed the answer in SwiftUI NavigationLink immediately navigates back and made sure that each item in the List has a unique identifier,

How to apply .italic() to .largeTitle Font?

五迷三道 提交于 2020-05-09 08:15:33
问题 import SwiftUI import PlaygroundSupport struct ContentView: View { var body: some View { VStack { ForEach(Font.TextStyle.allCases, id: \.self) { style in Text(self.describe(style: style)).font(.system(style)).italic() } } } func describe(style: Font.TextStyle) -> String { var s: String = "" print(style, terminator: "", to: &s) return s } } PlaygroundPage.current.setLiveView(ContentView()) produce is it a bug or I missed something? 回答1: Final answer from Apple Resolution:Investigation complete

How to apply .italic() to .largeTitle Font?

∥☆過路亽.° 提交于 2020-05-09 08:14:00
问题 import SwiftUI import PlaygroundSupport struct ContentView: View { var body: some View { VStack { ForEach(Font.TextStyle.allCases, id: \.self) { style in Text(self.describe(style: style)).font(.system(style)).italic() } } } func describe(style: Font.TextStyle) -> String { var s: String = "" print(style, terminator: "", to: &s) return s } } PlaygroundPage.current.setLiveView(ContentView()) produce is it a bug or I missed something? 回答1: Final answer from Apple Resolution:Investigation complete