Post

Replies

Boosts

Views

Activity

Reply to Receive error when attempting to use .listStyle() function.
Thanks for showing your code. You may need to use Answers to show additional info well formatted. I do not have enough time to watch the session video carefully, but your code seems to be taken from the session video or the sample code for the session. It is intended to be compiled with Swift 5.5/Xcode 13. Please try changing .listStyle(.carousel) to .listStyle(CarouselListStyle()). But there may be other parts you need Swift 5.5.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’21
Reply to Filter in ForEach SwiftUI
it works just with the valori property but not with the date property Seems the description is not correct enough. When I input 2021 into the textField, the list keeps showing the entries containing 2021. You are using "\($0)".contains(text) for filtering, but do you really understand what sort of Strings are generate by "\($0)"? As far as I tested with Xcode 12.5/iOS 14.5 Simulator, they were as follows: LifetimeInputsModel(id: FB973EBF-D56B-438D-BB8B-5EFDFA63983A, valori: 300.0, date: 2021-06-13 21:35:27 +0000) LifetimeInputsModel(id: 3A57A94C-79EA-4430-90B6-D415C460C243, valori: 200.0, date: 2021-06-14 21:35:27 +0000) Do you want to make the word LifetimeInputsModel hit all entries? Apps should not rely on the default String representations generated by Swift runtime. One possible way, to control the String representation of a struct would be adding CustomStringConvertible conformance. Please try adding this extension to your project and see if the filter works as expected: extension LifetimeInputsModel: CustomStringConvertible { var description: String { return "\(String(format: "%.0f", valori)) \(dateFormatter.string(from: date))" } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’21
Reply to Error in try await URLSession.shared.data
You should better use Code Block properly which improves readability and increases the chance to get better responses sooner. But generally, Swift for Ubuntu cannot be the main topic of the dev forums. This site is mainly intended to discuss and share info about Apple's frameworks on Apple's platforms. And the final Swift 5.5 is not released yet. Foundation types such as URLSession would be ported into Ubuntu, but it may not be the same time as the Swift 5.5 for Apple's platforms is released. You should better visit swift.org and get info about the status of Swift 5.5 for Ubuntu there.
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’21
Reply to Foundation's new Attributed String in UIKit
NSAttributedString is given a new initializer taking an AttributedString. convenience init(_ attrStr: AttributedString) You can easily convert an AttributedString to an NSAttributedString: var astr = AttributedString("Hello, world!") if let range = astr.range(of: "world") { astr[range].font = .boldSystemFont(ofSize: 22) } label.attributedText = NSAttributedString(astr)
Topic: App & System Services SubTopic: General Tags:
Jun ’21
Reply to Thread 1: signal SIGABRT
Generally, you would see some more info in the debug console when you get Thread 1: signal SIGABRT. Better check it again. But when you get it on the line let destinationVC = segue.destination as! ViewController, the most suspicious thing is segue.destination being non-ViewController. Have you checked which segue is invoked and what is set in the Custom Class of the target view controller?
Jun ’21
Reply to Can we use the SwiftUI for every IOS app version?
is it possible to use the app for sub version of IOS like iPhone 6s devices ? I may be mistaking what you mean by sub version of IOS, but you should better check the documentations of SwiftUI components. For example, View -- a very basic component in SwiftUI -- has an Availability notation as iOS 13.0+. Generally, SwiftUI was introduced in iOS 13 and SwiftUI apps run only on devices with iOS 13 or later. If the app may be using some feature available only in later iOS, it will run on devices with such iOS versions.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’21