# Core Libraries

**URL:** https://forums.swift.org/c/development/corelibs/8.md?page=2

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

**Page:** 3

---

## [Seeing zlib warning errors in Swift on Linux Mint 20.3](https://forums.swift.org/t/seeing-zlib-warning-errors-in-swift-on-linux-mint-20-3/58525)

<div class="topic-metadata">

**Author:** [@dsmith60](https://forums.swift.org/u/dsmith60)\
**Replies:** 0\
**Last updated:** [June 28, 2022, 4:05am UTC](https://forums.swift.org/t/seeing-zlib-warning-errors-in-swift-on-linux-mint-20-3/58525 "2022-06-28T04:05:28Z")

</div>

Good Evening Swift Forum, Respectfully asking for guidance/direction in an issue I am running into when running swift. I seem to be getting zlib warning errors when going into swift repl via command line on Linux Mint. …

---

## [Should we define \_GNU\_SOURCE in SwiftGlibc?](https://forums.swift.org/t/should-we-define-gnu-source-in-swiftglibc/53817)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 4\
**Last updated:** [June 20, 2022, 1:54pm UTC](https://forums.swift.org/t/should-we-define-gnu-source-in-swiftglibc/53817 "2022-06-20T13:54:25Z")

</div>

This topic has come up a couple of times in the past: Defining \_GNU\_SOURCE for module-map-included headers (2015) Libc portability, \_GNU\_SOURCE, platform checks... oh my (2017) The latter post has some especially inte…

---

## [CGRect intersection gives surprising result due to floating point arithmetic](https://forums.swift.org/t/cgrect-intersection-gives-surprising-result-due-to-floating-point-arithmetic/21336)

<div class="topic-metadata">

**Author:** [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Replies:** 9\
**Last updated:** [June 1, 2022, 3:32pm UTC](https://forums.swift.org/t/cgrect-intersection-gives-surprising-result-due-to-floating-point-arithmetic/21336 "2022-06-01T15:32:54Z")

</div>

Due to FP rounding, we have the following result: let rect = CGRect(x: 100.33333333333333333333333, y: 0, width: 100, height: 100) let infinite = CGRect.infinite let intersection = infinite.intersection(rect) print(in…

---

## [BinaryInteger.formatted() crashes on big numbers](https://forums.swift.org/t/binaryinteger-formatted-crashes-on-big-numbers/57656)

<div class="topic-metadata">

**Author:** [@idrougge](https://forums.swift.org/u/idrougge)\
**Replies:** 3\
**Last updated:** [May 30, 2022, 8:49am UTC](https://forums.swift.org/t/binaryinteger-formatted-crashes-on-big-numbers/57656 "2022-05-30T08:49:59Z")

</div>

In a REPL or in an app, this code will crash on the (totally undocumented) formatted() call: var v: UInt64 = 123 v.formatted() // "123" v = 13846165101762005916 v.formatted() // Execution interrupted. ( Apple Swift ver…

---

## [Base64 Encoding RFC](https://forums.swift.org/t/base64-encoding-rfc/56836)

<div class="topic-metadata">

**Author:** [@brevansio](https://forums.swift.org/u/brevansio)\
**Replies:** 0\
**Last updated:** [April 20, 2022, 6:40am UTC](https://forums.swift.org/t/base64-encoding-rfc/56836 "2022-04-20T06:40:13Z")

</div>

I found that Swift doesn't specify an RFC in the documentation like the other specs sometimes do. I am pretty sure from the implementation and the options that we're using RFC 4648. Is that correct? Second, is it worth …

---

## [URL FormatStyle and ParseStrategy](https://forums.swift.org/t/url-formatstyle-and-parsestrategy/56607)

<div class="topic-metadata">

**Author:** [@icharleshu](https://forums.swift.org/u/icharleshu)\
**Replies:** 9\
**Last updated:** [April 12, 2022, 8:32pm UTC](https://forums.swift.org/t/url-formatstyle-and-parsestrategy/56607 "2022-04-12T20:32:32Z")

</div>

Hi all! The Foundation team is working on bringing FormatStyle and ParseStrategy to URL. We are introducing two types, URL.FormatStyle and URL.ParseStrategy, as a simple, familiar, and error-proof interface for you to co…

---

## [Lock implementation in the Swift Async Algorithms package](https://forums.swift.org/t/lock-implementation-in-the-swift-async-algorithms-package/56440)

<div class="topic-metadata">

**Author:** [@Alexandre\_Lopoukhine](https://forums.swift.org/u/Alexandre_Lopoukhine)\
**Replies:** 3\
**Last updated:** [April 2, 2022, 10:09am UTC](https://forums.swift.org/t/lock-implementation-in-the-swift-async-algorithms-package/56440 "2022-04-02T10:09:28Z")

</div>

Would it make sense to create a separate package with the lock implementation here? This is code that I've implemented may times (almost all incorrectly, and none portably) and is tricky to get right in general. I don…

---

## [URLSession downloadTask cannot configure timeout and also cannot downlaod with resume data](https://forums.swift.org/t/urlsession-downloadtask-cannot-configure-timeout-and-also-cannot-downlaod-with-resume-data/55654)

<div class="topic-metadata">

**Author:** [@WXGBridgeQ](https://forums.swift.org/u/WXGBridgeQ)\
**Replies:** 1\
**Last updated:** [March 1, 2022, 4:45pm UTC](https://forums.swift.org/t/urlsession-downloadtask-cannot-configure-timeout-and-also-cannot-downlaod-with-resume-data/55654 "2022-03-01T16:45:15Z")

</div>

Using URLSession downloadTask to download some file from URL, by setting timeoutIntervalForResource of the session configuration, and in urlSession(\_:task:didCompleteWithError:) delegate trying to get resumeData with NSU…

---

## [\[FOU\] AttributedString Advanced Attribute Behaviors](https://forums.swift.org/t/fou-attributedstring-advanced-attribute-behaviors/55057)

<div class="topic-metadata">

**Author:** [@jmschonfeld](https://forums.swift.org/u/jmschonfeld)\
**Replies:** 2\
**Last updated:** [February 3, 2022, 11:35pm UTC](https://forums.swift.org/t/fou-attributedstring-advanced-attribute-behaviors/55057 "2022-02-03T23:35:14Z")

</div>

Apple's Foundation team is working on adding new capabilities to AttributedString to support some new behaviors when working with advanced attributes. We'd like to get your feedback on the proposed enhancements below. Th…

---

## [URLComponents(url:) is much faster than URLComponents(string:) - possible bridging performance issue?](https://forums.swift.org/t/urlcomponents-url-is-much-faster-than-urlcomponents-string-possible-bridging-performance-issue/54507)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 6\
**Last updated:** [January 8, 2022, 4:19am UTC](https://forums.swift.org/t/urlcomponents-url-is-much-faster-than-urlcomponents-string-possible-bridging-performance-issue/54507 "2022-01-08T04:19:51Z")

</div>

I've noticed a rather strange performance difference between URLComponents(url:resolvingAgainstBaseUrl:) and URLComponents(string:) - namely that the former seems a fair bit faster than the latter. This is on a macOS 11.…

---

## [CI not testing Foundation overlay?](https://forums.swift.org/t/ci-not-testing-foundation-overlay/51595)

<div class="topic-metadata">

**Author:** [@xwu](https://forums.swift.org/u/xwu)\
**Replies:** 4\
**Last updated:** [November 27, 2021, 5:58am UTC](https://forums.swift.org/t/ci-not-testing-foundation-overlay/51595 "2021-11-27T05:58:44Z")

</div>

The Foundation overlay is a bit of a conundrum to work with at present: The Xcode project cannot be compiled, at least if one adheres to the instructions, because it requires the use of the default toolchain (due to SR-…

---

## [Substraction between dates](https://forums.swift.org/t/substraction-between-dates/53681)

<div class="topic-metadata">

**Author:** [@Nickolas\_Pohilets](https://forums.swift.org/u/Nickolas_Pohilets)\
**Replies:** 1\
**Last updated:** [November 24, 2021, 4:44pm UTC](https://forums.swift.org/t/substraction-between-dates/53681 "2021-11-24T16:44:44Z")

</div>

I see there are static func + (lhs: Date, rhs: TimeInterval) -\> Date static func - (lhs: Date, rhs: TimeInterval) -\> Date But no static func - (lhs: Date, rhs: Date) -\> TimeInterval Is this asymmetry intentional? Or …

---

## [Combine handleEvents is marked as Debugging tool](https://forums.swift.org/t/combine-handleevents-is-marked-as-debugging-tool/53660)

<div class="topic-metadata">

**Author:** [@blazej.sleboda](https://forums.swift.org/u/blazej.sleboda)\
**Replies:** 1\
**Last updated:** [November 23, 2021, 6:49pm UTC](https://forums.swift.org/t/combine-handleevents-is-marked-as-debugging-tool/53660 "2021-11-23T18:49:57Z")

</div>

Combine HandleEvents operator is listed in Debugging section and on the operator details page in Discussion there is an example code which prints to the console. Those elements rise discussion about if handleEvents can b…

---

## [Deprecation warning in attempt to convert Apple's reference function in AVCameraCalibrationData.h to object-oriented Swift](https://forums.swift.org/t/deprecation-warning-in-attempt-to-convert-apples-reference-function-in-avcameracalibrationdata-h-to-object-oriented-swift/53602)

<div class="topic-metadata">

**Author:** [@kennystrawnmusic](https://forums.swift.org/u/kennystrawnmusic)\
**Replies:** 0\
**Last updated:** [November 19, 2021, 5:58pm UTC](https://forums.swift.org/t/deprecation-warning-in-attempt-to-convert-apples-reference-function-in-avcameracalibrationdata-h-to-object-oriented-swift/53602 "2021-11-19T17:58:10Z")

</div>

After doing days of research, I was able to write the following Swift class that, as you can see, does something similar to the reference example of Line 20 of the AVCameraCalibrationData.h file used to demonstrate how t…

---

## [JSONDecoder().decode failing on struct containing array(s)](https://forums.swift.org/t/jsondecoder-decode-failing-on-struct-containing-array-s/53583)

<div class="topic-metadata">

**Author:** [@Eddie](https://forums.swift.org/u/Eddie)\
**Replies:** 1\
**Last updated:** [November 19, 2021, 12:36am UTC](https://forums.swift.org/t/jsondecoder-decode-failing-on-struct-containing-array-s/53583 "2021-11-19T00:36:53Z")

</div>

I am attempting to parse data received from my server. The data is defined by the struct PlayerList (A), and includes 3 arrays, one being the list of Player's ( B ), and the others, String's. When I try to parse the main…

---

## [How to build and debug JSONDecoder?](https://forums.swift.org/t/how-to-build-and-debug-jsondecoder/44690)

<div class="topic-metadata">

**Author:** [@ZevEisenberg](https://forums.swift.org/u/ZevEisenberg)\
**Replies:** 6\
**Last updated:** [August 27, 2021, 5:27pm UTC](https://forums.swift.org/t/how-to-build-and-debug-jsondecoder/44690 "2021-08-27T17:27:55Z")

</div>

I’d like to learn more about how JSONDecoder works, and investigate whether a thing I think is a bug is actually a bug, and maybe fix it if it is. I tried pulling just the JSONDecoder-related files into an Xcode project,…

---

## [Combine map with switchToLatest confuse](https://forums.swift.org/t/combine-map-with-switchtolatest-confuse/51445)

<div class="topic-metadata">

**Author:** [@douknow](https://forums.swift.org/u/douknow)\
**Replies:** 0\
**Last updated:** [August 24, 2021, 2:58am UTC](https://forums.swift.org/t/combine-map-with-switchtolatest-confuse/51445 "2021-08-24T02:58:29Z")

</div>

I have a source publisher, and have an another publisher rely source publisher. This is playground test code for my situation: import Foundation import Combine import PlaygroundSupport PlaygroundPage.current.needsInde…

---

## [Controlling flow in task based URLSession](https://forums.swift.org/t/controlling-flow-in-task-based-urlsession/51185)

<div class="topic-metadata">

**Author:** [@Daniel\_Steinberg](https://forums.swift.org/u/Daniel_Steinberg)\
**Replies:** 2\
**Last updated:** [August 14, 2021, 11:53am UTC](https://forums.swift.org/t/controlling-flow-in-task-based-urlsession/51185 "2021-08-14T11:53:31Z")

</div>

Hi, We can do quite a bit with AsyncSequences, AsyncStreams, and the async APIs that we could do with Combine. As has been noted, one of the things we can't easily do is regulate flow. I apologize if this has been aske…

---

## [CFRunLoop reading 8 bytes from any signalled file descriptor on Linux](https://forums.swift.org/t/cfrunloop-reading-8-bytes-from-any-signalled-file-descriptor-on-linux/50431)

<div class="topic-metadata">

**Author:** [@PALKOVNIK](https://forums.swift.org/u/PALKOVNIK)\
**Replies:** 12\
**Last updated:** [August 12, 2021, 9:33am UTC](https://forums.swift.org/t/cfrunloop-reading-8-bytes-from-any-signalled-file-descriptor-on-linux/50431 "2021-08-12T09:33:42Z")

</div>

Hello everyone This is something I've discovered like 18 months ago or so, but I had local workaround that was ok at the time. Some context: I have a pet project, where I'm writing UI toolkit for Linux in swift. It was…

---

## [Pitch: XCTAssertNoThrow with result validation](https://forums.swift.org/t/pitch-xctassertnothrow-with-result-validation/19647)

<div class="topic-metadata">

**Author:** [@hybridcattt](https://forums.swift.org/u/hybridcattt)\
**Replies:** 19\
**Last updated:** [July 9, 2021, 4:37pm UTC](https://forums.swift.org/t/pitch-xctassertnothrow-with-result-validation/19647 "2021-07-09T16:37:26Z")

</div>

Hi everyone, This is my first post here and my first pitch for Swift. Looking forward to the feedback :slight\_smile: Introduction Swift 2 has introduced error handling mechanism, which has been widely adopted since. S…

---

## [URL Path on Windows](https://forums.swift.org/t/url-path-on-windows/40459)

<div class="topic-metadata">

**Author:** [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Replies:** 10\
**Last updated:** [September 22, 2020, 8:06pm UTC](https://forums.swift.org/t/url-path-on-windows/40459 "2020-09-22T20:06:39Z")

</div>

What are the intended semantics of the various path‐related methods of URL? Which methods are supposed to use a URL path separator (i.e. /), and which are supposed to use the platform path separator (i.e. \\ on Windows)? …

---

## [FoundationNetworking](https://forums.swift.org/t/foundationnetworking/24769)

<div class="topic-metadata">

**Author:** [@millenomi](https://forums.swift.org/u/millenomi)\
**Replies:** 28\
**Last updated:** [May 29, 2021, 9:32pm UTC](https://forums.swift.org/t/foundationnetworking/24769 "2021-05-29T21:32:23Z")

</div>

All, there was a pitch to move URLSession and some related types to a new module some time ago. We have been working on implementing it, and a patch is now available in the swift-corelibs-foundation repository. I want …

---

## [New GCD API: DispatchWorkItem.current like Thread.current](https://forums.swift.org/t/new-gcd-api-dispatchworkitem-current-like-thread-current/48880)

<div class="topic-metadata">

**Author:** [@bnyu](https://forums.swift.org/u/bnyu)\
**Replies:** 2\
**Last updated:** [May 27, 2021, 4:38am UTC](https://forums.swift.org/t/new-gcd-api-dispatchworkitem-current-like-thread-current/48880 "2021-05-27T04:38:07Z")

</div>

Hi, I’d like to propose a change to add a new GCD API, so we can use DispatchWorkItem more like to Thread. open class DispatchWorkItem { public class var current: DispatchWorkItem? { get } } This makes using it in…

---

## [Posix\_spawnattr\_init on Android 8.1 and earlier](https://forums.swift.org/t/posix-spawnattr-init-on-android-8-1-and-earlier/48106)

<div class="topic-metadata">

**Author:** [@Molanda](https://forums.swift.org/u/Molanda)\
**Replies:** 6\
**Last updated:** [May 16, 2021, 12:42am UTC](https://forums.swift.org/t/posix-spawnattr-init-on-android-8-1-and-earlier/48106 "2021-05-16T00:42:42Z")

</div>

I've updated my Android app to use Swift 5.4 and notice that it no longer works with Android 8.1 (API 27) and earlier. It appears there was a change introduced in Process.swift to use posix\_spawnattr\_init, which is only…

---

## [\[Windows\] NSString.standardizingPath and relative symlinks](https://forums.swift.org/t/windows-nsstring-standardizingpath-and-relative-symlinks/47981)

<div class="topic-metadata">

**Author:** [@Eugene\_Gubin](https://forums.swift.org/u/Eugene_Gubin)\
**Replies:** 4\
**Last updated:** [May 11, 2021, 8:48pm UTC](https://forums.swift.org/t/windows-nsstring-standardizingpath-and-relative-symlinks/47981 "2021-05-11T20:48:04Z")

</div>

// file is symlink with relative path \`../file\` print(("g:\\\\Projects\\\\SourceryDeps\\\\PathKit\\\\Tests\\\\PathKitTests\\\\Fixtures\\\\symlinks\\\\file" as NSString).standardizingPath) Output: g:/Projects/SourceryDeps/PathKit/Tests…

---

## [Autolinking behavior of @\_implementationOnly with static linking](https://forums.swift.org/t/autolinking-behavior-of-implementationonly-with-static-linking/44393)

<div class="topic-metadata">

**Author:** [@kateinoigakukun](https://forums.swift.org/u/kateinoigakukun)\
**Replies:** 9\
**Last updated:** [April 27, 2021, 2:54pm UTC](https://forums.swift.org/t/autolinking-behavior-of-implementationonly-with-static-linking/44393 "2021-04-27T14:54:55Z")

</div>

I want to confirm that I'm using @\_implementationOnly correctly with static library in autolinking aspect. Currently, Foundation imports CoreFoundation with @\_implementationOnly attribute other than Linux and Darwin pl…

---

## [Apparent contention in futex related to libswiftcore (5.3 arm linux)](https://forums.swift.org/t/apparent-contention-in-futex-related-to-libswiftcore-5-3-arm-linux/47645)

<div class="topic-metadata">

**Author:** [@William\_Dillon2](https://forums.swift.org/u/William_Dillon2)\
**Replies:** 9\
**Last updated:** [April 23, 2021, 8:37pm UTC](https://forums.swift.org/t/apparent-contention-in-futex-related-to-libswiftcore-5-3-arm-linux/47645 "2021-04-23T20:37:19Z")

</div>

I've been looking at a performance problem we've been seeing in Arm32/Linux since switching to Swift 5.3 (from 5.1). This is in an environment where it's cross-compiled via Yocto/bitbake, and we're also working on upstr…

---

## [\[GSoC 2021\] Increase differentiable programming’s language coverage](https://forums.swift.org/t/gsoc-2021-increase-differentiable-programming-s-language-coverage/45631)

<div class="topic-metadata">

**Author:** [@JeremyLim](https://forums.swift.org/u/JeremyLim)\
**Replies:** 6\
**Last updated:** [April 13, 2021, 10:11am UTC](https://forums.swift.org/t/gsoc-2021-increase-differentiable-programming-s-language-coverage/45631 "2021-04-13T10:11:15Z")

</div>

Hello @rxwei! My name is Jeremy and I am an undergraduate at National University of Singapore. I am currently studying Chemical Engineering, however, I have taken several classes in Computer Science and I am very intere…

---

## [Print prebuilt module declarations like produced by Xcode](https://forums.swift.org/t/print-prebuilt-module-declarations-like-produced-by-xcode/46710)

<div class="topic-metadata">

**Author:** [@loters](https://forums.swift.org/u/loters)\
**Replies:** 0\
**Last updated:** [March 19, 2021, 1:39am UTC](https://forums.swift.org/t/print-prebuilt-module-declarations-like-produced-by-xcode/46710 "2021-03-19T01:39:46Z")

</div>

Hi, When I write in Xcode code such as import Darwin and click Jump to Definition, I get an output like so: import Darwin.AssertMacros import Darwin.Availability import Darwin.C import Darwin.ConditionalMacros import D…

---

## [Implementing URLSessionWebSocketTask](https://forums.swift.org/t/implementing-urlsessionwebsockettask/45491)

<div class="topic-metadata">

**Author:** [@xorgy](https://forums.swift.org/u/xorgy)\
**Replies:** 0\
**Last updated:** [March 9, 2021, 8:12pm UTC](https://forums.swift.org/t/implementing-urlsessionwebsockettask/45491 "2021-03-09T20:12:58Z")

</div>

I'm interested in implementing URLSessionWebSocketTask and associated functionality on URLSession. Looks like swift-corelibs-foundation URLSession leans on libcurl, and implementing WebSockets on top of libcurl is somet…

[Previous page](https://forums.swift.org/c/development/corelibs/8.md?page=1)

[Next page](https://forums.swift.org/c/development/corelibs/8.md?page=3)
