Questions tagged [swift5.7]

Use this tag only for questions directly related to changes in version 5.7 of Apple's Swift programming language. Use the tag [swift] for more general language questions, or the tags [ios], [cocoa], [apple-watch] etc. for questions about developing on Apple platforms.

Swift 5.7 is a version of the Swift language developed by Apple and was released 12th September 2022 with Xcode 14.0.

The following language, standard library, and Swift Package Manager proposals were implemented in Swift 5.7.

Concurrency

Type System Enhancements

  • SE-0309: [Unlock existentials for all protocols]
  • SE-0326: [Enable multi-statement closure parameter/result type inference]
  • SE-0328: Structural opaque result types
  • SE-0341: Opaque Parameter Declarations
  • SE-0345: if let shorthand for shadowing an existing optional variable
  • SE-0346: Lightweight same-type requirements for primary associated types
  • SE-0347: Type inference from default expressions
  • SE-0348: buildPartialBlock for result builders
  • SE-0352: Implicitly Opened Existentials
  • SE-0353: Constrained Existential Types
  • SE-0358: Primary Associated Types in the Standard Library
  • SE-0360: Opaque result types with limited availability
  • SE-0361: Extensions on bound generic types

String Processing

  • SE-0350: Regex Type and Overview
  • SE-0351: Regex builder DSL
  • SE-0354: Regex Literals
  • SE-0355: Regex Syntax and Run-time Construction
  • SE-0357: Regex-powered string processing algorithms
  • SE-0363: Unicode for String Processing

Pointer Usability

  • SE-0333: Expand usability of withMemoryRebound
  • SE-0334: Pointer API Usability Improvements
  • SE-0349: Unaligned Loads and Stores from Raw Memory

Swift Package Manager

  • SE-0292: Package Registry Service
  • SE-0339: Module Aliasing For Disambiguation
36 questions
1
vote
1 answer

Type 'any View' cannot conform to 'View' when initiating UIHostingViewController with different View conformances

I really like the Swift type-systems. But I cannot fathom why I cannot do this: var view: View if #available(tvOS 15.0, *) { view = ManageProfilesView.MainView( viewModel: .init(), …
Seto
  • 1,234
  • 1
  • 17
  • 33
1
vote
1 answer

How to get character from Unicode in correct way when UnicodeScalars are not working?

I searched for the answer past days, and lot of them are very old (around swift 2 and 1.2). I wanted to get characters when unicode code is taken from the variable. Because for some unkown reason that consturction won't work in…
Sebastian
  • 448
  • 4
  • 14
1
vote
2 answers

Cannot specialize protocol type

Swift5.7 came with primary associated type. I try with these codes, But it shows up with error: Cannot specialize protocol type 'GenericDelegate' class BaseResponse {} class ConcreteResponse: BaseResponse {} protocol GenericDelegate:…
Learing
  • 559
  • 4
  • 13
0
votes
3 answers

Currency formatter SwiftUI

I'm trying to format as the user inputs a value into the textfield. I have the following code already but I couldn't find a way to do this into the textfield. import SwiftUI struct ContentView: View { @State private var amount: String = "" …
0
votes
0 answers

Can DocC interactive tutorials be hosted?

I'm exporting and hosting DocC documentation successfully on GitHub pages for my Swift framework yet the interactive tutorials I've written don't seem to be accessible. I've tried multiple different urls /documentation/myframework/tutorials/,…
pinglock
  • 982
  • 2
  • 12
  • 30
0
votes
0 answers

Swift - Background App Refresh Task not Running

Using Swift 5.7 and Scenes I want to make an HTTP call to an endpoint when the app goes to the background. My current implementation is not working and I am unsure on which part is incorrect. A lot of the resources online (SO, Apple docs) are…
Mega
  • 36
  • 3
0
votes
0 answers

Swift 5.7 RegexBuilder: Nested TryCapture - transform / Mapping Output?

Here in this example I tried to capture two Int values and then capture them together as a struct. This gives a "Thread 1: signal SIGABRT" error. (NOTE: I know that my example could be fixed by simply not nesting the Captures and handling the…
The Fox
  • 1,189
  • 1
  • 6
  • 10
0
votes
1 answer

How to parse the string content of debugDescription in XCUITest swift

As debugDescription returns the XCUIElement UI Tree and this if of type String. Want to fetch specific information based upon parameters like label :[String] will return all the label values, find_Application - will return the bundleID etc
Indrajit
  • 331
  • 1
  • 5
  • 12
0
votes
0 answers

SwiftUI - Keyboard gets dismiss after the first character on the second textfield in Form

I have a form with some of the textfields using the default keyboard. In the example below, the first textfield is using numberPad, and the second and third are using the default keyboard. When I try to input any value in the first field, it works…
0
votes
0 answers

Possible to configure Swift RegexBuilder DSL Capture '.url' to work with a Markdown link?

Is it possible to configure the Swift RegexBuilder DSL Capture .url(…) to precisely capture the URL within standard Markdown link syntax? If yes, then how? Minimal Pattern Attemp let inputMD = "[Markdown link text](https://example.com)" let regexMD…
marc-medley
  • 8,931
  • 5
  • 60
  • 66
0
votes
1 answer

How to use Swift 5.7 RegexBuilder to find a word after a sentence

I get a report from networksetup -listnetworkserviceorder terminal command for all networks services. The returned text is like this: An asterisk (*) denotes that a network service is disabled. (1) Ethernet (Hardware Port: Ethernet, Device:…
Hadi Sharghi
  • 903
  • 16
  • 33
0
votes
0 answers

SwiftUI: How do I share an ObservedObject between child views without affecting the parent view

TL;DR: If I have a view containing a NavigationSplitView(sidebar:detail:), with a property (such as a State or StateObject) tracking user selection, how should I make it so that the sidebar and detail views observe the user selection, but the parent…
Cheezzhead
  • 298
  • 1
  • 8
0
votes
0 answers

Monitor for Keypress in Meun/Picker in SwiftUI on MacOS

I'm learning SwiftUI programming by trying to duplicate basic features in the MacOS Finder. The groups button in the Finder window (screenshot below) has me stumped. Clicking the menu shows the group options, while option-clicking shows the sort…
user09274385
  • 55
  • 1
  • 9
0
votes
1 answer

how to write a function that takes coordinate(lat - long) and take snapshot from desired location with lookaround.snapshotter in Swift?

I just started programming in Swift and I am a complete beginner. I wanted to write a function or class that, by receiving the coordinates, if there is a photo in MKLookAround.request, saves a photo of the desired location using…
0
votes
1 answer

Compile error "Sendability of function types in instance method 'someMethod' does not match requirement in protocol 'SomeProtocol'" iOS 16 Swift 5.7

After updating to Xcode 14, iOS 16, Swift 5.7, when compiling the project I got: Sendability of function types in instance method 'addObserver(forName:object:queue:using:)' does not match requirement in protocol 'NotificationCenterProtocol'
Nikolay Suvandzhiev
  • 8,465
  • 6
  • 41
  • 47