Search results for

swiftui

16,581 results found

Post

Replies

Boosts

Views

Activity

SwiftUI - Xcode 11 Dev Beta 1: TabbedView Doesn't Refresh or Display When Switching Tabs
I'm having an issue playing around with the TabbedView that doesn't seem to load the content when I switch between tabs in the Simulator.If I have the app start on Tab 1, using something like:TabbedView(selection: .constant(1))...the content within the view of the first tab displays perfectly. But after clicking on Tab 2 manually, the content in Tab 2's view doesn't display. However, if I have the app start with Tab 2, the content in Tab 2 displays fine...but the content of Tab 1 doesn't display when I click on it. It's almost as if it isn't refreshing the view in a TabbedView situation as I attempt to switch between them, but each loads properly when it is designated as the TabbedView's starting position only.If I don't designate starting position, the app defaults to Tab 1 as the starting point and the issue remains the same as if I had designated the starting point manually.With SwiftUI being so new, I'm probably just missing something very simple...Any ideas? Thanks everyone!Dump of ContentView.S
1
0
1.3k
Jun ’19
@EnvironmentObject crashes View when presented with PresentationButton
When presenting this view with a PresentationButton it crashes the preview and the Simulator. When presented with a NavigationButton, it works fine. Is this intended behavior? Should EnvironmentObject not work with modal presentations?import SwiftUI struct AddListView : View { @EnvironmentObject var listStore: LinkListStore // Cause of crash var body: some View { Text(HELLO) } } #if DEBUG struct AddListView_Previews : PreviewProvider { static var previews: some View { AddListView() .environmentObject(LinkListStore()) } } #endif
4
0
5.6k
Jun ’19
SwiftUI Tutorial (Combining Views) - Map Pin missing
Working through the Combining Views (first) tutorial on SwiftUI, I notice that the images and previews in the tutorial show a pin on the map for the specified location. My app doesn't have that.I double checked the code in the download and I can't see any difference... except that my lat/long are specified as (latitude: 34.011286, longitude: -116.166868) and the download code has (latitude: 34.011_286, longitude: -116.166_868)...Is this just a tutoirial glitch? (That the pin doesn't appear...)Or a documentation error? (It isn't supposed to appear...)Given that it looks useful, how difficult would it be to add the pin?Thanks in advance...
1
0
1.4k
Jun ’19
SwiftUI Landmark sample app issue when running on device
Hi folks,Trying out SwiftUI. The Landmark sample app on my iphone.It builds, installs on the phone fine, launches but then quits immediately.(Works fine on the simulator with same device specified) (iphone Xs)Error is:dyld`__abort_with_payload: 0x1002ba5f0 <+0>: mov x16, #0x209 0x1002ba5f4 <+4>: svc #0x80-> 0x1002ba5f8 <+8>: b.lo 0x1002ba610 ; <+32> 0x1002ba5fc <+12>: stp x29, x30, [sp, #-0x10]! 0x1002ba600 <+16>: mov x29, sp 0x1002ba604 <+20>: bl 0x1002b998c ; cerror_nocancel 0x1002ba608 <+24>: mov sp, x29 0x1002ba60c <+28>: ldp x29, x30, [sp], #0x10 0x1002ba610 <+32>: retHave tried addingSwiftUI.framework,UIKit.frameworklibswiftui.tbdto the Link Binary with Libraries.Still no dice.Any pointers will be appreciated. Thanks !Mac (10.15 Beta)iPhone Xs (12.3.1)Xcode (11.0 beta)
2
0
865
Jun ’19
Environment:
Have been watching 'Data Flow through SwiftUI' https://developer.apple.com/videos/play/wwdc2019/226/Can the Environment in Swift UI be used in place of singleton models eg. Like AppState, Models data used in several different tabs in tabbed application. So where traditionally it would either be held by Appdelegate (not recommended but still done) or have Singleton that holds onto these... we can keep it in the Environment? or Does it work as persisted information only in a view's hierarchy
0
0
678
Jun ’19
Reply to SwiftUI Collection View
According to some developers who talked with SwiftUI engineers, there won't be an equivalent to collection views, at least not yet.However, it's still possible to integrate platform-specific collection views with SwiftUI. Also, there has been huge improvements to collection view data source and layout this year. 🙂
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Core Data Model SwiftUI
Are there any best practices or sample code provided for SwiftUI and Core Data?Specifically, using a Core Data NSManagedObject as a data provider of a View. Is it a @ObjectBinding? How do you handle the PreviewProvider? If I'm passing in a Core Data object presumably I need a whole context and store coord to instantiate.
24
0
25k
Jun ’19
Drawing Paths and Shapes tutorial won't compile
I'm going through the newly published SwiftUI tutorials, in particular Drawing Paths and Shapes here: https://developer.apple.com/tutorials/swiftui/drawing-paths-and-shapesIn Step 4 of 5 Combine the Badge Foreground and Background, intermediate step 3 you are required to add the GeometryReader code to the body variable...var body: some View { ZStack { BadgeBackground() GeometryReader { geometry in self.badgeSymbols .scaleEffect(1.0 / 4.0, anchor: .top) .position(x: geometry.size.width / 2.0, y: (3.0 / 4.0) * geometry.size.height) } }}But Xcode complains after adding the GeometryReader that the ZStack trailing closure is Unable to infer complex closure return type; add explicit type to disambiguateAm I missing something? To my eyes, my code is identical to the tutorials.I decided to compile the Complete version of the tutorial that comes with the downloaded zip. That seems to compile without complaint. Here's a screenshot of the two source code files side by side. https://imgur.com/azzjjx9
3
0
1.2k
Jun ’19
Form Container in Swift UI
In the SwiftUI Essentials video, around the halfway mark they mention using a Form container element to wrap form elements in a structured list view. When I tried adding this to the Avocado Toast Swift UI file, I got an Unresolved Identifier error that it didn't recognize the Form struct. Is it just that we're in Beta 1 of XCode and that struct hasn't been added to SwiftUI yet?- Scott
6
0
3.0k
Jun ’19
Reply to How to pop a NavigationButton programmatically?
If, as stated during the WWDC, everything in SwiftUI from scrollView contentOffset to Button highlight status is strictly related to the concept of Source-of-Truth and State/Binding, then there should be somewhere a State property (or something similar) that could be changed in order to alter the state of the Navigation. My two cents.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
Xcode 11: Local Packages not finding sources files
I've tried to create a local package as shown in https://developer.apple.com/videos/play/wwdc2019/410The package seems to be imported correctly, but the source files are not found.// Lunch/Lunch/ContentView.swift import SwiftUI import FoodNStuff struct ContentView : View { var body: some View { Text(LunchItem().text) // Use of unresolved identifier 'LunchItem' } }// Lunch/FoodNStuff/Sources/FoodNStuff/LunchItem.swift import Foundation struct LunchItem { var text = Foo }https://styrka.app/images/Screenshot%202019-06-08%20at%2020.04.25.pnghttps://styrka.app/images/Screenshot%202019-06-08%20at%2020.04.36.pngI'm usingXcode Version 11.0 beta (11M336w)macOS 10.15 Beta (19A471t)
2
0
2.5k
Jun ’19
Xcode 11 and SwiftUI issue
Good morning!I'm having an issue when coding in SwiftUI where the canvas/preview of the iPhone will not showing up and it says that there has been an error. The error states Cannot preview this fileHere's the current software I'm running:- Xcode 11.0- macOS 10.15 beta 1
4
0
2.2k
Jun ’19