Since Xcode Beta2, I been waiting and hoping that Image View with system images will be working for macOS App, as it does for iOS Apps.To be more precise:In a macOS App project, this line of codeImage(systemName: star.fill)produces the error: Extraneous argument label 'systemName:' in callI just upgraded to latest Catalina and Xcode beta4.I wonder, if anyone knows a workaround to this problem or know other information about when it will be possible to use system images in macOS Apps as it is possible in iOS Apps.
Search results for
swiftui
16,622 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am playing around with a Tinder-style interface. Right now I have the cards hard-coded in. I have an array of my Card objects. I would like to know how to populate the Zstack with an array or something more scalable(if you have any suggestions for that). I would also like to increment the .offset x and y values. I have searched all day and can't find anything on how to do any of this.struct ContentView : View { @State var cards = Array(repeating: NewCard(), count: 3) var body: some View { ZStack { Image(plant) .resizable() ZStack { ForEach(cards, id: .id) { card in card.offset(x: card.x, y: card.y) } // cards[2] // .offset(x: -10, y: -20) // cards[1] // .offset(x: -5, y: -10) // cards[0] } } } }
I have the same issue in the SwiftUI (debug) Peview and a iPhone Xr-simulator too.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I'm working on a little project that started showing this error after I started using Realm. It was fine before that.(Using Xcode Beta 4 and SwiftUI)
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Here is a method which seems to work with Xcode 11 Beta 4. I have created 50000 and displayed them in a List by binding the result of a fetch request without having the 50000 faults being fired.I use SwiftUI List with the .objectIDproperty as id instead of implementing Identifiable:List(myStore.arrayOfManagedObjects, id:.objectID)Then in my cell View, I fire the fault in onAppear by accessing a property of the NSManagedObject.My NSManagedObject implements BindableObject so that when it is realized from database (awakeFromFetch), willchange is send and the cell view is refreshed.It seems to work. Will post code later if requested.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
I have a swiftUI native Watch app I Am working on. I have a combine based class that allows me to store userdefaults, one of which is a simple toggle ..import SwiftUI import Foundation import Combine class MeetingSetup: BindableObject { let willChange = PassthroughSubject<Void, Never>() var twitterEnabled: Bool = false { didSet { willChange.send() } } init() { let prefs:UserDefaults = UserDefaults(suiteName: group.com.appname)! twitterEnabled = prefs.bool(forKey: keyTwitterEnabledBool) } }In the SwiftUI I am getting the error messages that 'Bool' is not convertible to 'Binding<Bool>'import SwiftUI import Combine struct SetupView : View { @ObjectBinding var meetingSetup: MeetingSetup = delegate.meetingSetup var body: some View { HStack{ Toggle(isOn: self.meetingSetup.twitterEnabled){ // <== 'Bool' in not convertible to 'Binding<Bool>' Text(Twitter) } } }I don't understand why this is getting the message since the code is @ObjectBinding, should it not be
I know I could use one.
I created a class of lazy variables, each of which fetches an entity. I then use that in a SwiftUI view and iterate over the elements of trhe entity array, passing the element into the detailed view.lazy var myentitys: [MyEntity]? = { guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return nil } let managedContext = appDelegate.persistentContainer.viewContext let request: NSFetchRequest = MyEntity.fetchRequest() let sortDescriptor = NSSortDescriptor(key: date, ascending: false) request.sortDescriptors = [sortDescriptor] if let theEntities = try? managedContext.fetch(request) as [MyEntity] { return theEntities } return nil }()
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
Working through the SwiftUI tutorial, I reached the Composing Complex Interfaces section and downloaded the project files.On opening the Starting Point project, the first task is to create a new SwiftUI view named Home.swift. If you activate the Preview for the unmodified new view, the Preview pane displays an error message whicj says that building Home.swift fails. Preview works for other views in the project, but not this one.I tried opening the completed project, and the same problem occurs for Home.swift in that project.I've tried cleaning the build, restarting Xcode, even restarting Catalina, and still can't get this to work.Anyone seen something similar, or can you suggest a workaround?TIA,Doug K
Hi AllJust checking in to see if this is affecting other people, or if it's a problem on my side.I'm running the latest Catalina beta (19A512f) and the latest Xcode beta (11M374r) and I'm trying to learn SwiftUI using the tutorials.The first several were AWESOME, but then I had to take a couple of weeks of due to scheduling challenges in my day job, and when I came back, there was a new beta (B3) and things didn't seem to work quite right; items that had compiled and run correctly previously stopped doing so. Using automatic fixes, I muddled through a bit, but decided to wait until the next beta. Now that I'm on B4, I thought I'd try again, and things still don't match up.I'm looking at the Working with UI Controls tutorial, and there are several things that need to be fixed right out of the gate, with a fresh clean download. I even went back to an earlier one (Animating Views and Transitions) and tried to run it, and it failed several ways.So I'm assuming that since this is a young framework, it's j
FWIW, this is the one I'm currently looking at:https://developer.apple.com/tutorials/swiftui/working-with-ui-controls
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I need to listen my list contentOffset in order to implement some custom prefetching logic. How may i implement this using SwiftUI ?
I cannot get a simple independent Watch App to run on my Apple Watch.I am running Watch OS6 Beta 4 on the watch, iOS13 Beta 4 on my iPhone, Catalina Beta 4 on my Mac, and Xcode 11 Beta 4.I open Xcode and create a new independent Watch App using the template, I don't make any changes to the code. I can run this on the simulator and it displays Hello using SwiftUI, all good. I then change the target to the Apple Watch via My iPhone and attempt to run it. Xcode beach balls for about 10-15 seconds and then says Running TestApp on paired Watch, however nothing ever appears on the Apple Watch. No icon is displayed on the Apps Screen. I am at a loss on what to do and any help would be appreciated in getting this resolved.Due to the current networking issues on the Watch simulator I am completely blocked again.
I don't reproduce the problem in the simulator with 10 or less items and I am short on devices to run the betas.That said, I am not sure where the fetch should be done, maybe onAppear is not the best place. Originally I took it from a sample here:https://mecid.github.io/2019/07/03/managing-data-flow-in-swiftui/Maybe, the functional way would be to do it lazily when the fetched results controller is accessed.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags:
When doing SwiftUI, very often you need to wrap a block in another SwiftUI view. Is there a way I can highlight the lines and make it indent one level, and wrap that insdie { }? Like this:line 1line 2line 3to become{ line 1 line 2 line 3}?