Post

Replies

Boosts

Views

Activity

Reply to If statement notification
Isn't this the same question as in your previous post? You should better reply to comments and answers to it before writing a duplicate post.
Jun ’21
Reply to Find My unable to connect to server
Please try again later. Have you taken enough time when you tried again? Apple's server related to WWDC may be getting too heavy and some services would not work properly. And anyway, iOS 15 beta is a beta version of a product and it may contain many flaws or bugs. If the issue continues even if you try it later (with enough interval), you should better send a bug report.
Jun ’21
Reply to Can I use async/await under iOS15.0?
There's some discussion about the same issue on forums.swift.org . Will Swift Concurrency deploy back to older OSs? It seems to be true that the runtime needed for await/async is provided as part of the new OSs. It is a very sad fact that most of us developers need years to adopt this bright and successful new feature. My company follows three-generation policy to support older OSs, which means we can use async/await when iOS 17 will be out. I cannot be sure if I could remember that we could use this feature three years from now. Apple should consider backward compatibility more severely to make this sort of great feature more popular in apps.
Topic: Programming Languages SubTopic: Swift Tags:
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
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 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 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 If statement notification
Isn't this the same question as in your previous post? You should better reply to comments and answers to it before writing a duplicate post.
Replies
Boosts
Views
Activity
Jun ’21
Reply to Find My unable to connect to server
Please try again later. Have you taken enough time when you tried again? Apple's server related to WWDC may be getting too heavy and some services would not work properly. And anyway, iOS 15 beta is a beta version of a product and it may contain many flaws or bugs. If the issue continues even if you try it later (with enough interval), you should better send a bug report.
Replies
Boosts
Views
Activity
Jun ’21
Reply to xcode-beta-13
I could have extracted Xcode-beta.app with just double-clicking Xcode_13_beta.xip on my Mac mini 2018. How much free storage do you have?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Can I use async/await under iOS15.0?
There's some discussion about the same issue on forums.swift.org . Will Swift Concurrency deploy back to older OSs? It seems to be true that the runtime needed for await/async is provided as part of the new OSs. It is a very sad fact that most of us developers need years to adopt this bright and successful new feature. My company follows three-generation policy to support older OSs, which means we can use async/await when iOS 17 will be out. I cannot be sure if I could remember that we could use this feature three years from now. Apple should consider backward compatibility more severely to make this sort of great feature more popular in apps.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Decoding Downloaded Data
Can you show an example of the downloaded data? If it is in an original format, you may need to implement init(data:) all by yourself, without using Codable.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Decoding Downloaded Data
If you want to use the data as Data (or NSData), use the downloaded data as is.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to In Swift, how can I make an attributed string only italicize the second instance of a word in a string?
You can write something like this: var atext: AttributedString = "The little duck marveled at the sight of the bigger ducks playing in the lake" if let range = atext.range(of: "duck") { atext[range].font = .body.italic() }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Duplicate back buttons
I guess you are nested NavigationViews.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to CBService changed: How handle this in iOS 14 and 15?
Can you try something like this? func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) { let optPeripheral: CBPeripheral? = service.peripheral guard let peripheral = optPeripheral else { return } let result: CBPeripheral = peripheral print ("\(result)") }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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?
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Jun ’21
Reply to How to give default value to TableColumn in Table
One possible solution would be adding a computed property: extension Item { var nameDefaulted: String {name ?? "default"} } struct ItemTable: View { let items: [Item] var body: some View { Table(items) { TableColumn("Name", value: \.nameDefaulted) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21
Reply to Two `async let` do not run the calculation in parallel
This is the output when I tested your code on iOS 15 simulator: [start] longCalculation / is on main thread: false [start] longCalculation / is on main thread: false [end] longCalculation / is on main thread: false [end] longCalculation / is on main thread: false [end] action / is on main: true Can you clarify your environment used for the test?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’21