S
FranzBusch: Is it the right choice to default the implicit to consuming if we believe there might be value further down the road to lift the borrowing restriction? It would add yet another case of where something behaves differently than the "norm". I think I would personally rather write the consuming modifier out. Nickolas_Pohilets: IMO, that's redundant. Attempt to call the function will diagnose the error anyway. I agree that it makes sense to lift the borrowing restriction now, even if…
S
I’m with Xaiodi on this. CustomStringConvertible indicates whether a specific entry point for stringification is available, not whether stringification as a whole is sensible to do. If it did mean that, it would just be called StringConvertible. If your logging framework needs to distinguish between types it makes sense to log and types it doesn’t, you will probably need to create your own protocol to model that and conform whatever types you think appropriate, possibly including Never.
S
Hello, Swift community! The review of SE-0565: Allow Deprecating Package Products begins now and runs through November 25, 2026. Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to me as the review manager by email or DM. When contacting the review manager directly, please put "SE-0565" in the subject line. What goes into a review? The goal of the review process…
S
LLM-driven security efforts like this are probably going to push projects more to safer languages like Swift, though I wonder what holes such scanners would find in Swift itself. May be worth setting up some security model like that for the Swift codebase to see what it finds.
S
tbh I misinterpreted the second version (just _ContiguousArrayBuffer) in the early-morning fog of under-caffeination. It seems ok; I'd be interested to see it in context (in a branch I can test.)
S
Hmm. I was thinking of the limit generally being “I don’t want to overwrite more than this many elements” rather than “I only want to copy a prefix”, but I can see your point.
S
I like the copyingFrom: idea for the label. John_McCall: I'm not sure I see the need for the variant that returns an iterator; this just doesn't seem worth special-casing vs. the existing variant that mutably copies from an iterator. That's fair. I wonder if having only (a) the postcondition-enforcing variant that takes an Iterable or (b) the inout BorrowingIteratorProtocol version puts too much distance between two related API. The variant that returns an iterator is a fairly short editing…
S
I switched in 2014 and still love it. Very glad to have the grammarians in the Swift team providing such an enabling and disciplined language.
S
Hi all, I have a draft PR, [Sema] Diagnose fixes shared across all ambiguous solutions (#87218) by carloshpdoc · Pull Request #89572 · swiftlang/swift · GitHub, for #87218 and I am blocked on a design question in the constraint solver diagnostics. I would appreciate guidance before going further. For this code: let dictionary = [String: [String]]() var optionalValue: String? if let array = dictionary["foo"] { array.append(optionalValue) } the compiler only says no exact matches in call to…
S
Thanks, @kavon and Slava_Pestov, for the review and the merge, and @tkremenek again for getting this moving. <3 ps: The forum doesn't let me mark up more than two people
S
It took me two full days to successfully wrap my head, and the code, around how to actually use Iterable. You only really need to use it if you work with noncopyable types and noncopyable array storage, and sometimes you can even get away without enabling the experimental Lifetimes feature (but you most likely will need to eventually; its only mentioned once in the proposal). ApproachableConcurrency is something different and isn't related to iterable (and idk what the feature actually does).…
S
I found plenty of articles explaining its design, but no actual end-to-end code. I've tried: struct MyBorrowingIterator: BorrowingIteratorProtocol { @_lifetime(&self) // '@_lifetime' attribute is only valid when experimental feature Lifetimes is enabled mutating func nextSpan(maxCount: Int) throws(Never) -> Span<UInt8> { // A mutating method cannot return a ~Escapable result return .init() } } Is there a full guide to creating a type? What do I need in the "Package.swift" file? It has…
S
I prepared this Add _assumeNonNegative on _RigidArray count property by lorrden · Pull Request #94193 · swiftlang/swift · GitHub
S
A beginner-friendly introduction to the official Swift SDK for Android 1. Introduction For most of its life, Swift was known as the language for iPhone, iPad and Mac apps. That changed with Swift 6.3, which shipped the first official Swift SDK for Android. You can now compile Swift code for Android devices using official tools published on swift.org, instead of relying on unofficial community toolchains. This tutorial walks you through the whole path from zero: what the pieces are, how to…
S
Swift Networking Workgroup Meeting Notes Meeting Details Date: November 9, 2026 Summary The group agreed to mark the IPAddress enum @frozen and to add byte order initializers to the IP address and Port types. Initial benchmarking tooling will come in and run in shadow mode before the group settles on specific metrics. Francesco presented a WebTransport client and server built on HTTP/3, which led to general agreement that WebTransport, QUIC, and HTTP datagrams should share common abstractions…
S
On another note, are there any plans to support non-string map keys? I'm mostly thinking about formats like CBOR.
S
It probably is, but should also be configurable. There are, unfortunately, backends which treat them differently, for encoding and decoding. Codable's inability to control that behavior lead to some unfortunate required manual coding.
S
I noticed that @CommonCodable encodes nil optional properties as explicit null, whereas synthesized Codable omits them. For example: // Codable {"name":"Ada"} // @CommonCodable {"name":"Ada","nickname":null} Is this behavior intentional?
S
I suspect it would be easier to create (within Foundation) final class Preferences: UserDefaults, Sendable {} (Preferences by analogy to CFPreferences, also considered AppStorage by analogy to SwiftUI's property wrapper, but feel free to bikeshed) and then anyone who needs Sendable UD can fairly trivially give up subclassing to transition to this instead. Then you could also deprecate UD, if you wanted. You could also consider playing tricks in a major OS SDK update, changing:…
S
I wonder if this is something that is worthwhile enough to have a dedicated compiler hack for (like there is to make DispatchQueue.main.async { ... } take a MainActor closure)
S
John_McCall: On the access front, the current proposal is making a valiant attempt at a purely type-based modeling of aliases, but I think this effort would be more successful if we acknowledged that aliased and non-aliased accesses need to be distinguished in the language. The more I think about it, the more necessary I think this general model of aliased storage, borrows, and mutations is for delivering the feature set we really want. Strictly speaking, though, I don't think it needs to block…
S
Ah that's a good point, and that may be a reason why we wouldn't want to take that approach in general as well: there's no guarantee that SomeUserDefaultsSubclass.standard returns a Sendable instance given subclasses can override the implementation.
S
jmschonfeld: On Darwin platforms this property is declared in an Objective-C header and I'm not certain whether it's possible to add the & Sendable constraint via an Objective-C header on Darwin. I'd expect that adding NS_SWIFT_SENDABLE somewhere there would work, but haven't tried it yet so it may need compiler support. If adding NS_SWIFT_SENDABLE doesn’t work, I believe it would be possible to do… @property (class, readonly, strong) NSUserDefaults *standardUserDefaults NS_REFINED_FOR_SWIFT;…
S
An approach like this does seem plausible. It looks like it may work in most cases, but the 2 things that I can think of that concern me are: On Darwin platforms this property is declared in an Objective-C header and I'm not certain whether it's possible to add the & Sendable constraint via an Objective-C header on Darwin. I'd expect that adding NS_SWIFT_SENDABLE somewhere there would work, but haven't tried it yet so it may need compiler support. Doing this is technically a breaking change…
S
LGTM. I've merged it. Thanks!
S
I wonder if a better design would be allow non final classes to be (checked) Sendable, just require their subclasses to explicitly restate Sendability (essentially preventing cases where subclasses could break sensibility).
S
sure, via GAI or @unchecked Sendable if you ensure you uphold all Sendable requirements for the entire hierarchy, even non-Sendable superclasses. Difficult though!
S
It wouldn't. What Nickolas is asking for is very narrowly scoped: for the standard var to return a composition of UserDefaults & Sendable, taking advantage of what @jmschonfeld said a few posts up about the base class being thread safe. If you were implementing this in Swift 6, you'd write something like: static var standard2: UserDefaults & Sendable { unsafeDowncast( UserDefaults.standard, to: (UserDefaults & Sendable).self ) } Which compiles with no warnings or errors. Idk if this is a good…
S
Yeah, so I still feel that copying: doesn't really capture the relationship between this operation and the iterator that it's draining values out of. There ought to be a preposition on the iterator variant, like copyingFrom:, which to me suggests both that the elements are being removed from the iterator and that it might not copy all of the elements from the iterator. If we make that change, I don't think the "all" is really necessary on the iterable variant, because I think collections[1]…
S
Could a non-final class be Sendable?