Hi guys, So I'm Still pretty new to SwiftUI and wondering on how I can implement the following. I create multiple pages (Views) with SwiftUI and I have a home page and other pages. However, I also have a login page and I want to lock the user to the Login page first and stuck on that page before being able to see the other pages. So far I have the log in page fully working where it sends the username/password data to my server and my server authenticates it and returns if its correct or not. But the main question for me is how do I make SwiftUI change pages after the server returns true after trying to log in.
Search results for
swiftui
16,623 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have not seen a workaround or fix, I have not heard from Apple, has anyone got any formal information on this? Again, I'd think nearly everyone working on the Beta would be playing with Combine and SwiftUI and as far as I can see, we'd all have this same issue.Anyone know where to go next on this issue?How to get a word from Apple on it?
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I'm trying to get an example project using CoreData and QueryGenerationTokens working. The essence of the project is to be committing changes to a background context on a timer (emulating changes coming down from a server) that shouldn't be displayed until an action is taken on the UI (say, a button press).Currently, I have changes being saved on the background context (an entity is being added every 5s and saved) and they are automatically coming into the view context (as expected, .automaticallyMergesChangesFromParent is set to true). Where things go wrong, I am pinning the view context before any of these changes happen to the current query generation token. I would expect the view to not update with the background items being added, but it is updating with them. So it seems the query generation tokens are having no effect?Some of the possible issues I've thought of:- the only example (https://developer.apple.com/library/archive/releasenotes/General/WhatNewCoreData2016/ReleaseNotes.html#//apple_ref/doc/uid
Simple problem, I want a view that consists of a rounded rectangle with a red border and a clear fill. Here is some simple code. For sake of seeing the problem easier, I have removed the fill (and it appears the default fill is black).import SwiftUI struct ContentView: View { var body: some View { RoundedRectangle(cornerRadius: 30) .frame(width: 100, height: 100) .border(Color.red, width: 4) } } #if DEBUG struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } #endifRun this code, you'll see a black filled rounded rectangle bounded by a red border. However, the border is not rounded, it is a simple rectangle.Is this a bug, or am I missing something?
My SwftUI code suddenly started getting this error but only happens when using Canvas. Works fine in the Simulator and no errors or warnings. Any idea if this is a bug in SwiftUI or something in my code? I have looked at all of my # statements and they all seem to have matching # statments. I have also looked at the sorce code files in hex and they all seem to be ended properly with a 0A. sooo... don't know how else to continue.
Hi allI am trying to get my head round how i can achive the following using the MVVM design pattern with SwiftUI.I want to have only 1 instance of a networking operation queue (using OperationQueue) where any view model that needs to send any networking requests but i have heard that creating a Singleton is not preferred and i should be passing the networking queue object around where it is needed.So if i create the instance of the network operation queue in the Scene Delegate and pass them into the ContentView initialiser and store it in an object there to then pass into the views then created.This doesnt seem like good MVVM design practice as from what i understand the View should Own the ViewModel only?What is the best way of achieving this?Thanks
Using SwiftUI (Xcode 11 beta 5) is there a way of popping up an edit menu just like UIMenuController?
>I have this app which uses 2 UISplitViewControllers on 1 screenOn iOS 13.x, I would use something along these lines, instead (clipped from the beta release notes/SwiftUI/New Features):You can style a NavigationView using two new style properties: StackNavigationViewStyle and DoubleColumnNavigationViewStyle. By default, navigation views on iPhone and Apple TV visually reflect a navigation stack, while on iPad and Mac, a split-view styled navigation view displays. (51636729)When using the DoubleColumnNavigationViewStyle style, you can provide two views when creating a navigation view — the first is the master and the second is the detail. For example:
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Has anyone gotten @Environment(.presentationMode) to work correctly on a device?When I try and use:self.presentation.value.dismiss()on a page pushed from a navigation link it works on the simulator but crashes on device.import SwiftUI import Combine struct ContentView: View { @State private var showModal = false @State private var showCamera = false var body: some View { NavigationView { Text(Hello World) .navigationBarTitle(, displayMode: .inline) .navigationBarItems( leading: NavigationLink( destination: ModalView(message: Dismiss Push Test), label: {Text(Push Page)}), trailing: Button(Show modal) { self.showModal = true }.sheet(isPresented: $showModal, onDismiss: { print(self.showModal) }) { ModalView(message: Dismiss Modal view) } ) } } } struct ModalView: View { @Environment(.presentationMode) var presentation let message: String var body: some View { NavigationView { Button(message) { self.presentation.value.dismiss() } .navigationBarItems(trailing: Button(Done) { self.presentation.value.dismis
Hello,Stuck on the Badge section of SwiftUI Tutorials. Issue started on Macbook Pro, and I've tested on my iMac as well with the same results. Test on both the completed and the starting point Xcode projects. When trying to preview the Badge views, I receive the error in preview Cannot preview in this file — Landmarks.app may have crashedThe build succeeds, but I cannot preview.Diagnostic report:Landmarks.app crashed: Error Domain=render service Code=12 Rendering service was interrupted UserInfo={NSLocalizedDescription=Rendering service was interrupted}Any help would be greatly appreciated! I am a struggling ameteur developer.Sincerely,Chris
Interesting update and discovery. Removing .fill(Color.black)Resolves the issue initially. From completed badge section, removing all the .fill from Badge files fixes issue. I haven't completed the project yet, and I still don't quite understand this. Any knowledge would be still greatly appreciated!//Badge.swift import SwiftUI struct Badge: View { var body: some View { Path { path in var width: CGFloat = 100.0 let height = width path.move(to: CGPoint(x: width * 0.95, y: height * 0.20)) HexagonParameters.points.forEach { path.addLine( to: .init( x: width * $0.useWidth.0 * $0.xFactors.0, y: height * $0.useHeight.0 * $0.yFactors.0 ) ) } } .fill(Color.black) } } #if DEBUG struct Badge_Previews: PreviewProvider { static var previews: some View { Badge() } } #endif
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
We raised a bug on this, but just double checking we are not doing something silly, has anyone seen this?We set up a FetchRequest like this:@FetchRequest(entity: Activity.entity(), sortDescriptors: [NSSortDescriptor(keyPath: Activity.name, ascending: true)], predicate: NSPredicate(value: true), animation: .default) var test : FetchedResultsand then try to use it in a view:ForEach (test) { activity in Text(activity.name) }But get the following compile-time bug:*** Value of type 'ServerObject' has no member 'name'Now the type of the entity is Activity defined as:@objc(Activity) public class Activity: ControlledResource { ... @objc(ControlledResource) public class ControlledResource: ServerObject { ... @objc(ServerObject) publicclass ServerObject: NSManagedObject, Identifiable {And Actifvity definitely has name, this is an existing app and core data model being migrated to swiftui. name works in the original code.But it seems from the compiler error that the compiler thinks its the superclass type (Serv
I’m struggling getting the grasp of how build a fitting UI for a Watch App using SwiftUIWhat I mean by fitting is that I wanna create a screen that shows some informations without resorting to scrolling.The UI should be adaptive to the screen size and fit the UI elements and I would also like to be able to drop low priority UI elements when the space is not enough.I tried to create a sample VStack of Text elements and than use properties like `layoutPriority(...)` and `.minimumScaleFactor(...)` to let the content fit the container but with no luck.Given the following code. The result I see on screen is a list of big Texts overflowing the available space. Doesn’t matter what combination of `layoutPriority(...)` /`.minimumScaleFactor(...)` methods I usestruct ContentView: View { var body: some View { VStack() { Text(Hello World).font(.title) Text(Hello World).font(.title) Text(Hello World).font(.title) Text(Hello World).font(.title) Text(Hello World).font(.title) Text(Hello World).font(.title) Text(Hello World)
I need to implement something like an animated page control. And I don't want to use integration with UIKit if possible. And running into some strange behaviour. Maybe I'm just using it wrong, in which case please help me understand how to do it right. And maybe it is indeed a bug. Here is a link with all the info and code needed. #[https://stackoverflow.com/questions/57391615/swiftui-page-control-implementation?noredirect=1#comment101302276_57391615]XCode Version 11.0 beta 4, macOS Catalina 10.15 Beta
Please copy the relevant code here.As mentioned in SO, this is not a Swift question, but a SwiftUI.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: