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
9
votes
1 answer

any Identifiable can't conform to 'Identifiable'

update: add same error about Hashable I have created an Identifiable compliant protocol and compliant structures. Then, when I create the list and reference it in ForEach, I get the error Type 'any TestProtocol' cannot conform to 'Identifiable'(I…
tbt
  • 399
  • 3
  • 16
8
votes
5 answers

iOS16+ Present UIViewController in landscape only for single screen not working [Swift 5.7]

Before iOS 16 presenting a single screen in landscape is fine for portrait application. The working code is as below. Remark: Whole application is in Portrait mode only. override public var shouldAutorotate: Bool { return false } override…
Chetan Prajapati
  • 2,249
  • 19
  • 24
5
votes
2 answers

How to use Swift literal regex expressions in switch case pattern statements?

How to use Swift literal regex expressions in switch case pattern statements? Based on the examples from WWDC 2022 presention slides, the following is expected to compile and run OK: import Foundation import RegexBuilder switch "abc" { case…
marc-medley
  • 8,931
  • 5
  • 60
  • 66
5
votes
0 answers

Why can't swift 5.7 in toolchain find Regex?

I believe I'm running Swift 5.7 from the command line, and that Swift 5.7 should have the new Regex class and /.../ syntax. But It doesn't seem to. I have the following Swift source "parse.swift". But Swift didn't seem to understand the Swift 5.7…
clearlight
  • 12,255
  • 11
  • 57
  • 75
4
votes
0 answers

Apple Swift version 5.7 not working on Apple Swift version 5.6.1

We have built a binary framework built with Xcode 14.1 using Xcode 13.4.1 getting below error. BUILD_LIBRARY_FOR_DISTRIBUTION ENABLED ALSO. this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.7.1…
Ravikanth
  • 308
  • 1
  • 10
3
votes
1 answer

ProgressView inside SwiftUI List disappearing after list is updated

The circular (default) SwiftUI ProgressView disappears within a List whenever the list gets expanded with new content because of a .onAppear modifier on the ProgressView.  The ProgressView becomes invisible, although its allocated cell (and its…
Thofreym
  • 59
  • 6
3
votes
1 answer

SwiftUI with associated ViewModel Type can't be initialised from its hosting ViewController with Swift 5.7

I am defining a SwiftUI view with an associated ViewModel protocol type. However, I getting this error while building Type 'any MyViewModelType' cannot conform to 'MyViewModelType'. Here's my full code. protocol MyViewModelType: ObservableObject { …
Paras Gorasiya
  • 1,295
  • 2
  • 13
  • 33
3
votes
1 answer

How to capture more than 10 things using Swift 5.7's RegexBuilder?

Let's say I have a file that stores information about people, and one of the lines look like this: Sweeper 30 1992-09-22 China/Beijing - 0 2020-07-07 Mary/Linda - Pizza/Lemon From left to right, it's name, age, date of birth, country of birth, city…
Sweeper
  • 213,210
  • 22
  • 193
  • 313
3
votes
0 answers

How do I get automatic Encodable conformance with array property but without using generics?

I would like to define a struct with automatic conformance to Encodable, where the struct has an array of Encodable elements: struct EncodableBagB: Encodable { var values: [Encodable] // ❌ Type 'EncodableBagB' does not conform to protocol…
Senseful
  • 86,719
  • 67
  • 308
  • 465
2
votes
0 answers

Swift 5.7 RegexBuilder convert Array of strings to Regex - ChoiceOf options programatically

I would love to take an array of strings let array = ["one", "two", "three", "four"] and convert it to the regex builder equivalent of: Regex { ChoiceOf{ "one" "two" "three" "four" } } or basically the equivelant…
The Fox
  • 1,189
  • 1
  • 6
  • 10
2
votes
1 answer

Type any Protocol cannot conform to Protocol

I am facing an issue when trying to initialize a view in SwiftUI. Let me explain: I have a view called ExternalView, this view has a constraint with a protocol called ToggleableProtocol, then, this view internally consumes a view called…
MarkDev
  • 21
  • 3
1
vote
2 answers

NSError domain: "CBATTErrorDomain" - code: 128 0x0000000282b111a0

I am writing a code in swift to get data from a BLE device (Omron BP7000). I am able to pair with it and get the other service and read the data. But I am unable to get the data of the blood pressure, in didUpdateValueFor characteristic:. Other…
Kshitij876
  • 11
  • 4
1
vote
1 answer

Protocol with generics throws error when used as a property to call a method

I have a protocol SomeObjectFactory whose method createSomeObjectWithConfiguration(_ config: SomeObjectConfiguration) is used inside the class Builder. When I tried to compile this code with Swift 5.7 I ran into an error Member…
DesperateLearner
  • 1,115
  • 3
  • 19
  • 45
1
vote
1 answer

Swift Generics - Pass multiple types from caller

I have a function to talk to my REST server as follows func send(_ request: HTTPSClient.Request) async throws -> T { do { let (data, status): (Data, HTTPSClient.StatusCode) = try await request.send() if…
Suyash Medhavi
  • 1,135
  • 6
  • 18
1
vote
0 answers

What are the imports to use ContinuousClock() in Swift 5.7/Xcode 14 or if not an import, another means for it to compile successfully

Am trying to use the new ContinuousClock feature in Swift 5.7 using Xcode 14.0 (14A309) in a command line app with with the statement let clock = ContinuousClock() I get the following error: Cannot find 'ContinuousClock' in scope Is there an import…
Scott
  • 1,034
  • 1
  • 9
  • 19
1
2 3