Swift Run Time Library vs. Swift Standard Library
Asked Answered
H

2

3

In this tutorial on how to use CocoaPods I am having trouble understanding the following paragraph:

Unlike Objective-C, the standard Swift runtime libraries aren’t included in iOS! This means your framework must include the necessary Swift runtime libraries. As a consequence, pods written in Swift must be created as dynamic frameworks. If Apple allowed Swift static libraries, it would cause duplicate symbols across different libraries that use the same standard runtime dependencies.

Here are my questions:

  1. What exactly are the "standard Swift Runtime Libraries"? Is the Swift Standard Library one such standard swift run time library, would a framework I write in swift be considered a swift run time library?

  2. What exactly does "Swift runtime libraries are not included in iOS" mean? I guess I am having trouble inferring what "iOS" refers too.

Any additional insight, links, resources or explanations regarding this paragraph would be greatly appreciated!

Edit:

After reading the runtime library wiki article I am no longer confused about Q1. The following paragraph clarified this for me:

The concept of a runtime library should not be confused with an ordinary program library like that created by an application programmer or delivered by a third party, nor with a dynamic library, meaning a program library linked at run time. For example, the C programming language requires only a minimal runtime library (commonly called crt0), but defines a large standard library (called C standard library) that has to be provided by each implementation.

However I am still confused about Q2.

Hern answered 25/4, 2017 at 22:48 Comment(4)
Do you know what a runtime library is? What kind of answer you'll get will depends on your prior knowledge on thisPutput
Good question! I (wrongfully) thought a run time library was the compiled version of a"program library". Seeing your question made me doubt this. So I read the wiki article on runtime library and no longer need clarification for question 1. But am still confused about Q2. (I'll edit my question) Thanks!Hern
Objective C has a stable (unchanging) runtime library, so it makes sense for there to be one shared copy of the library, provided by the OS (macOS/iOS), available to all applications that need it. In contrast Swift is a rapidly evolving language, which means that its runtime library undergoes vast changes between versions. Because of this, Xcode bundles in a copy of the Swift runtime library as part of each app, to ensure that a copy of the correct version (the version the app uses) of the runtime library is available to the app.Putput
Perfect! Totally makes sense to me now!Hern
P
8

Objective C has a stable (unchanging) runtime library, so it makes sense for there to be one shared copy of the library, provided by the OS (macOS/iOS), available to all applications that need it. In contrast Swift is a rapidly evolving language, which means that its runtime library undergoes vast changes between versions. Because of this, Xcode bundles in a copy of the Swift runtime library as part of each app, to ensure that a copy of the correct version (the version the app uses) of the runtime library is available to the app.

Putput answered 26/4, 2017 at 0:52 Comment(0)
N
0

Swift Standard Library vs Swift Run Time Library

[Swift Standard Library]

Swift Run Time Library is a part of Swift Standard Library

Before iOS v12.2 there were not ABI[About] stability on iOS level, that is why you could see a lot of frameworks(Swift standard library[About]) inside each built target

Also you are able to adjust it via Always Embed Swift Standard Libraries(ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES) for targets before iOS v12.2

Nymph answered 26/9, 2022 at 19:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.