Good PDF with the Swift 4 Standard Library

I find myself digging all over the web to find information on the Swift 4 standard library. Is there some PDF somewhere that I’m just missing. Even a more organized set of web pages than Apple’s would be helpful.

1 Like

What do you mean with “information on the standard library”? Does The official book fit?

My guess is you mean a PDF (or any document) with every type and protocol definition in the Swift standard library.

So far Apple’s documentation has helped me a great deal. E.g.: The page about the FloatingPoint protocol is well filled with information. Though, admittedly, the site can come off a bit labyrinth-ish at times.

I’m unaware whether an offline version of this site exists.

This is more what I mean:

https://developer.apple.com/documentation/foundation

But when I look at:

https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/Status.md

I see there is a lot more there. Would be great if there were a way to learn more about all those classes without having to read so much source. ;)

cw

Exactly. I’m looking for something more readable than source but doesn’t need to be a tutorial.

A Java equivalent is:

https://docs.oracle.com/javase/8/docs/

cw

1 Like

Personally, I think the best documentation is stuff like http://swiftdoc.org

Unfortunately it’s quite old. We can ask @nnnnnnnn about updating it. It might also make sense to incorporate some kind of reference like that on Swift.org.

5 Likes

Yes, it should integrated and hosted at something like docs.swift.org or swift.org/docs. Given how long it took to get these forums online I wouldn’t hold my breath.

3 Likes

I think this question relates to this discussion:

Basically newcomers are looking for something like the java docs already mentioned or similarly in other languages:

https://docs.python.org/3/library/index.html
https://golang.org/pkg/#stdlib
http://www.ruby-doc.org/stdlib
etc

In swift there is no Standard Library in the traditional sense, so this doesn't exist. The closest thing is the Foundation documentation that @carlin mentioned, but this is maintained by Apple.

Swift does have a standard library, it’s just very limited in scope, similar to the C standard library.

That’s why I wrote “in the traditional sense” as for most languages “Standard Library” has a wider scope. And personally I find Swift’s scope a bit confusing. For example it contains JSON and Base64, but not CSV, ZIP or SHA1 (to give some random examples). I think the reasons are historical and have to do with what the NSXXX classes supported, rather than something that was curated.

1 Like

Swift’s standard library includes neither JSON nor Base64; that’d be the role of Foundation. For more on the division of labor, see the swift-corelibs-foundation FAQs.

I understand the desire to have different size of library then some other languages.

That being said, as a person that wants to get work done, it needs to be easier than it is today. Even having a page the explains why foundation is small and advice for what to do next would be helpful.
Cw

I'm confused; are you asking for documentation for the standard library or Foundation? Those are two different libraries.

I’m saying it isn’t obvious to new people that they are two different things and what’s in each. :)

The follow on question is is the plan to grow those (like some other languages do) or not.

Cw

Apologies, the truth is that I’ve been following Swift since 1.0 and I’m still confused with the division between standard library, Foundation, CoreFoundation and corelibs-foundation.

And to be honest it seems chaotic. If I wanted to lookup the base64 functions for Go or Python I would go to my bookmark of their standard library in golang.org and python.org respectively and find everything I need.

With Swift you basically have to google “swift base64” and go to a stack overflow answer. I’m not aware of any other straightforward way to discover it. And definitely there doesn’t seem to exist an answer under swift.org.

1 Like

Swift standard library:
https://developer.apple.com/documentation/swift

Foundation:
https://developer.apple.com/documentation/foundation

…of which, swift-corelibs-foundation is a partial reimplementation for Linux

Core Foundation:
https://developer.apple.com/documentation/corefoundation

Dispatch:
https://developer.apple.com/documentation/dispatch

To be fair Xiaodi, maybe some users are looking for the bane of library writers’ existence... beyond RTFM or RTFID (... inline docs), but maybe we need to explore this in this thread further with also members of the core team like yourself and others.


xwu
Xiaodi Wu

    February 23

Swift standard library:

https://developer.apple.com/documentation/swift

Foundation:

https://developer.apple.com/documentation/foundation

…of which, swift-corelibs-foundation is a partial reimplementation for Linux, with the following status:

github.com

apple/swift-corelibs-foundation/blob/master/Docs/Status.md

> 
> # Implementation Status
> This document lays out the structure of the Foundation project, and provides the current implementation status of each major feature.
> Foundation is divided into groups of related functionality. These groups are currently laid out in the Xcode project, even though they are in a flat structure on disk.
> As Foundation is a work in progress, not all methods and functionality are present. When implementations are completed, this list should be updated to reflect the current state of the library.
> #### Table Key
> ##### Implementation Status
> * _N/A_: This entity is internal or private and implemented ad hoc; there are no guidelines in place to suggest what completion might look like
> * _Unimplemented_: This entity exists, but all functions and methods are `NSUnimplemented()`
> * _Incomplete_: Implementation of this entity has begun, but critical sections have been left `NSUnimplemented()`
> * _Mostly Complete_: All critical sections of this entity have been implemented, but some methods might remain `NSUnimplemented()`
> * _Complete_: No methods are left `NSUnimplemented()` (though this is not a guarantee that work is complete -- there may be methods that need overriding or extra work)
> ##### Test Coverage
> * _N/A_: This entity is internal and public tests are inappropriate, or it is an entity for which testing does not make sense
> * _None_: There are no unit tests specific to this entity; even if it is used indirectly in other unit tests, we should have tests targeting this entity in isolation

I’m not sure I understand your question. There was a request for documentation, so I provided some links. There has been a lot of work to ensure their completeness. Are you aware of anything missing?

Also, I’m not part of the core team and have nothing to do with these resources. I do use them regularly, however.

More than inline docs… off-line docs. The request was for a PDF, not a hierarchy of web pages which require a network to access. I’d be just as happy with one of the book formats instead of PDF.

For macOS, Xcode provides offline documentation; you can also use Dash. For Linux, Dash docsets can be used with Zeal.