Search results for

swiftui

16,584 results found

Post

Replies

Boosts

Views

Activity

Reply to How to customize navigation bar tint color and text color in SwiftUI?
It doesn't work. It change NavigationButton color, but not a navBar or text color:import SwiftUI struct TaskList : View { var body: some View { List(0 ..< 5) { item in NavigationButton(destination: TaskEditor()) { Text(Hello World!) } } .navigationBarTitle(Text(Tasks), displayMode: .inline) .navigationBarItems(trailing: NavigationButton(destination: TaskEditor()) { Image(systemName: plus) }) .accentColor(Color(Light Green)) } } #if DEBUG struct TaskList_Previews : PreviewProvider { static var previews: some View { NavigationView { TaskList() } } } #endif
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Reply to @EnvironmentObject crashes View when presented with PresentationButton
That is the way Apple has demonstrated its use, but the environment object so far has been signifcantly buggy. For me, calling the environmentObject modifier more than once causes SwiftUI to fail resubscribing to the bindable object (I'm seeing two cancel messages instead of one). This creates an effect as if parts of my UI have become paralyzed. The only fix I've found is setting all environment objects at the root view of the UIScene where I know the body won't get called a second time.Right now, all we can do is submit tickets and hope the next beta fixes some of these issues.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Reply to Splitview in SwiftUI
According to the SwiftUI Essentials session this is achieved the following wayNavigationView { MasterView() DetailView() }Unfortunately like other things shown during sessions (for example TabbedView tab items with icons) it seems to not be working right now.I would keep an eye on upcoming betas, since the code comes from Apple it's bound to be correct - the SDK just needs to catch up.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Missing/Broken features in SwiftUI [List]
Hi guys, as many of you (I think), I have been busy learning SwiftUI as fast as I can. In my case for a new app I want to develop for personal purposes and probably for an App Store release.In my (small) learning journey I have found a few things that SwiftUI is missing or just not working, but since there is not too much information yet I wanted to make a simple thread with all the things I have found at the moment. This can be useful for anyone who is learning SwiftUI or wants to check current SwiftUI status.I promise to add my findings here and update this post as fast as I can.Feel free to mention every feature you think is important to have in the list, any features you think is not a bug or broken/missing feature, or any solution you may find to one of this mentioned problems.Ps: I know we have Xcode release notes but many of the current bugs of SwiftUI are not mentioned there.SwiftUI missing/broken features (as of beta 3):Can’t remove rows separator from Lis
31
0
16k
Jun ’19
SwiftUI: Fatal Error: Accessing State<String> outside View.body"
I have a MainView, which is my rootViewController, in SwiftUI.In there is a @State var myString : String that is bound to a Textfield.Theres a button that presents a UIViewController MyViewController from the rootViewController when pressed.The MyViewController has a delegate that calls a function delegateEnds in which I want to set the myString from the presentingViewController (line 11 of MyViewController.swift) to a certain value that a delegate (MyDelegate) delivers.This is where the error is happening: Thread 1: Fatal Error: Accessing State<String> outside View.bodyHow can I resolve this problem? My goal is to present the UiViewController and get a string result from it down to the MainView's myString variable that is bound to the Textfield, so that the TextField updates right away.Since I can't change the @state variabe from outside the view appearently, is there any other way?Thanks in advace! MainView.swift:struct MainView : View { @State var myString: String = var body: some View{ VStack{ Text
2
0
2.1k
Jun ’19
StringInterpolation inside SwiftUI
Anyone able to get custom StringInterpolations to work inside SwiftUI Text view?extension String.StringInterpolation { mutating func appendInterpolation(justDate value: Date) { let formatter = DateFormatter() formatter.dateFormat = yyyy-MM-dd let dateString = formatter.string(from: value) appendLiteral(dateString) } } struct MyView: View { var body: some View { Text(Now: (justDate: Date())}) // Doesn't work } func test() { print(Now: (justDate: Date())) // Works } }
2
0
920
Jun ’19
Reply to Splitview in SwiftUI
I've tried creating a SplitView myself with a UIViewControllerRepresentable. It works initially, but it crashes in many more complex scenarios. For example, trying to use NavigationDestinationLink to drive navigation constantly causes a crash about some internal environment object not existing. My thought is that the master and detail view controllers are getting split up into two different scopes somehow and making an environment object become unreachable.This may explain why Apple shows using a NavigationView to implicitly create a split view, so the internal environment object exists in both scopes.I also tried to implement the SplitView manually using a delegate, but then SwiftUI ends up not laying out views, so everything appears on top of each other initially until I interact with it.At this point, I'd just wait until Apple's official version is added.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
SwiftUI creates destination views before the user navigates to them
I am having a hard time creating in SwiftUI a pretty common use case in UIKit.Here is the scenario. Let's suppose we want to create a master/detail app in which the user can select an item from a list and navigate to a screen with more details.To get out of the common `List` examples from Apple's tutorial and WWDC video, the app needs to fetch the data for each screen from a REST API.The problem: the declarative syntax of SwiftUI leads to the creation of all the destination views as soon as the rows in the `List` appear.Here is an example using the Stack Overflow API. The list in the first screen will show a list of questions. Selecting a row will lead to a second screen that shows the body of the selected question. The full Xcode project is on GitHubFirst of all, we need a structure representing a question.struct Question: Decodable, Hashable { let questionId: Int let title: String let body: String? } struct Wrapper: Decodable { let items: [Question] }(The Wrapper structure is needed becaus
1
0
1.7k
Jun ’19
Reply to Core Data Model SwiftUI
Which part doesn’t work on complex entities/joins? I am migrating a very complex app over and am fairly comfortable SwiftUI will Carr for most cases so far, have some unexplored notification and navigation things, plus sig in with Apple etc I still need to work out.but is it the fact you cannot map the data to a proxy object? Or Is the fetch not triggering update on the nested entities? Or something else, like it just fundamentally “breaks”?I am just starting to think this one through so starting to work out how to handle this.My current thinking is 2-fold. The first is part is it appears you need to treat the data preparation and collation very much like redux. But this is of course a concern for large data sets. Out app generally doesn‘t show more than a handful of rows on any one biew a time generally, so thats not really a current concern. It appears the long term goal MAY be for nsfetchedresultscontroller, or a derivative/replacement to offer some layer of direct usage and potentially more suppo
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Reply to Beta 2 Finder crashing
Same here. I’ve been running Xcode Beta in Catalina Beta 2, and whenever I run an operation that uses Finder, such as creating a new swiftUI file, it could take 5 minutes or longer. And Finder would hang and crash throughout the system. I booted in safe mode and the issue persisted. Then, I disabled iCloud Drive in system preferences, and removed it from the sidebar in Finder. That seems to have resolved the issue for now, I’m back to using finder and Xcode without Finder hanging (in safe mode). Disabled safe mode and booted again. I can now confirm that the solution above has completely resolved the issue. Not sure if safe mode was necessary.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to AppStore does not offer older versions to new customers
This is a good question. I would like to redevelop an app using SwiftUI and other features which require iOS13 but also continue to support and issue fixes for the current version of the app for as long as older versions of iOS are supported by Apple. At the moment I think the only way I could do this would be to publish the new version as a new app which would require completely new set up in the app store, possibly fall foul of the duplicate functionality rule and also reduce revenue as proceeds from 'new subscriptions' for existing customers would be lower.
Jun ’19
SwiftUI - SF Symbols not rendering in tabItemLabel
I can get SF Symbols to work fine in main body views.This works:struct ContentView : View { var body: some View { VStack { Text(Hello world) Image(systemName: square.and.pencil) } } }But this does not - the tab item is emptystruct ContentView : View { @State private var selection = 0 var body: some View { TabbedView(selection: $selection){ Text(Hello world) .tabItemLabel( Image(systemName: square.and.pencil) ) .tag(0) } } }Is this a known issue?
3
0
2.4k
Jun ’19