Search results for

swiftui

16,581 results found

Post

Replies

Boosts

Views

Activity

Cannot preview SwiftUI
I am running Catalina (10.15) with XCode11. After creating a new project and selecting the option to Use SwiftUI, the file opens, but i get an error message in the preview window;'Cannot preview in this file -- active scheme does not build this file. 'the info button says 'Select a scheme that builds a target which contains the current file, or add this file to a target that is built by the current scheme.'i've tried opening numerous new projects, with and without unit tests, but none of them allow it to be previewed. I did see on Twitter that I'm not alone in seeing this issue. Any ideas on steps to troubleshoot it? Thanks all.
21
0
55k
Jun ’19
Reply to How can I add an image and text to a tab bar item with TabbedView?
I'm pretty sure there's a bug in the compiler for TabbedViews. For example, in slide 272 from the SwiftUI Essentials WWDC talk, they have this sample code:struct ContentView : View { var body: some View { NavigationView { TabbedView { OrderForm() .tabItemLabel { Image(systemName: square.and.pencil) Text(New Order) } OrderHistory() .tabItemLabel { Image(systemName: clock.fill) Text(History) } } } } }But I get an error on line 4 when trying to implement it in my own code:Cannot convert value of type 'TabbedView<Int, TupleView<(_ModifiedContent<MyView, _TraitWritingModifier<AnyView?>>, _ModifiedContent<ClassesContentView, _TraitWritingModifier<AnyView?>>)>>' to closure result type '_'
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’19
WWDC 204 Tutorial - didChange property of Store file causes error on Mac 10.14
I am following the video for the Introducing SwiftUI Building your First App video and am around the 40 minute mark where he has just added the Store swift file. The line didChange.send() gets a fatal error: Cannot invoke 'send' with no arguments. Did anyone have a similar issue and get through it? Or understand the send function and know if there's a parameter I can pass?I have checked my code multiple times but it is identical up to this point, and I have been running and rebuilding the app to my iOS 13 device every step of the way. I hope this isn't a random bug because I'm running Xcode on 10.14.RoomStore.swift-----import SwiftUIimport Combineclass RoomStore : BindableObject { var rooms: [Room] { didSet { didChange.send() ! Cannot invoke 'send' with no arguments } } init(rooms: [Room] = []) { self.rooms = rooms } var didChange = PassthroughSubject<Void, Never>()}
1
0
1.1k
Jun ’19
Reply to Catalyst : NSAppearanceNameAqua exception
I think this is a known issue and won't be resolved until beta 2 of Xcode 11.After doing a bit more research, the first known issue of Xcode 11 is Xcode 11 beta doesn’t support working with SwiftUI in a project configured to use UIKit for Mac.Link:https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_release_notes#3318344
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
SwiftUI Picker Doesn't Allow More than 8 Elements.
The follow code will produce the following error.Cannot convert value of type 'Binding' to expected argument type 'Binding<_>'import SwiftUI struct ContentView : View { @State private var KG: Int = 30; @State private var Adult: Bool = true; var body: some View { VStack { Picker(selection: $Adult, label: Text(Classification)) { Text(Adult).tag(true) Text(Pediatric).tag(false) } Picker(selection: $KG, label: Text(KG)) { Text(30).tag(30) Text(35).tag(35) Text(40).tag(40) Text(45).tag(45) Text(50).tag(50) Text(55).tag(55) Text(60).tag(60) Text(65).tag(65) Text(70).tag(70) Text(75).tag(75) Text(80).tag(80) } Button(action: { // Do Stuff }) { Text(Calculate) } } } } #if DEBUG struct ContentView_Previews : PreviewProvider { static var previews: some View { ContentView() } } #endifSteps to reproduce are as a follows.Create New Project (For Apple Watch)Use SwiftUIReplace the code in ContentView.swift with the above code.Wait for the error.I'm using XCode Version 11.0 beta (11M336w)Expected ResultI would
0
0
2.2k
Jun ’19
Reply to Integrating SwiftUI into existing project
Also have a similar problem, when I try to preview a SwiftUI in an existing project I get:(I am running macOS 10.15 beta & Xcode 11 beta)Error Domain=com.apple.dt.UITestingAgent Code=-1 Preview provider 10[APPNAME]20SwiftUIView_PreviewsV does not exist UserInfo={NSLocalizedDescription=Preview provider 10[APPNAME]20SwiftUIView_PreviewsV does not exist}I noticed in the SwiftUI tutorials that when creating a new project you have to check the Use SwiftUI checkbox, so I'm guessing it is some sort of build/project/info.plist setting that needs to be changed?I tried to compare a new project using SwiftUI with my existing project but couldn't find any SwiftUI settings as far as the project was concerned.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to SwiftUI Collection View
SwiftUI will not provide collection views or table views. Instead, you will use a List component to render lists of content.That said, you can of course wrap a UICollectionViewController in a SwiftUI View. However, going that route goes against the grain of what they are trying to accomplish with SwiftUI.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to SwiftUI Collection View
I agree these are not technically collection views or table views.What I meant and would like to achieve is a grid layout (like in Music's album library, Apple Books' library, etc.) or cascading layout (e.g. Pinterest) natively in SwiftUI.According to SwiftUI's documentation, a List is a container that presents rows of data arranged in a single column. What I'm looking for is a container that present data arranged in several columns and rows.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to Xcode 11 Beta SwiftUI Canvas.. not showing?
I have a similar issue. on reboot and reload of Hello World: SwiftUI the canvas does not appear. I client Editor, then Editor + Canvas, and nothing comes up. I was using the same project minutes ago prior to reboot. I keep building a new project to learn about SwiftUI and canvas . the + button does work as it adds new editors (files to edit and new this version, I can edit more than 2 files at the same time). On a 27 screen the new xCode is beautiful. fill the screen and usable except SwiftUI and Canvas is not 100% ready which is expected for 11 Beta 1
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to Catalina install failure
This may not be the right place.. But I need some help. I want to try the new SwiftUI from this weeks WWDC, and I want to install the new MacOS Catalina. I want to do it on a partition or volume. I have searched online and I am a success at creating either one, but when I start the installation process the partition drive does not show up or if it does it has the warning triangle, and is not an option to install the beta.I am using a MacBook Pro 2016.Can someone help me? What am I doing wrong here?
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
UIViewRepresentable of UITextView in SwiftUI layout issues
I'm trying to show a list with UITextView in the cells to display text the user can select. The text gets clipped, and if I specify isScrollEnabled = false then the text no longer wraps.Here's a simple version of my code:struct UITextViewContainer: UIViewRepresentable { let text: String func makeUIView(context: UIViewRepresentableContext<Self>) -> UITextView { let view = UITextView() view.isScrollEnabled = false view.isEditable = false return view } func updateUIView(_ uiView: UITextView, context: UIViewRepresentableContext<Self>) { uiView.text = self.text } } struct ContentView : View { var body: some View { List(1...5) { item in UITextViewContainer(text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur quis pharetra diam, rhoncus tristique orci. Nam semper interdum facilisis. Sed mollis ligula ac odio iaculis iaculis. Ut consectetur bibendum augue, at rutrum metus semper ut. Nam molestie, arcu sed commodo facilisis, erat sem consectetur sem, a mattis nisi libero cursus sapie
5
0
7.6k
Jun ’19