Using the Swift Playgrounds
An assorted list of maybe useful playgrounds that shed light on the theory of algorithms, the use of the Swift Standard Library, integration with C, and other experiments.
Getting Started
This GitBook page gives an overview of the available Swift Playgrounds, their intention and some initial motivation on why I created these. As the playgrounds are self-documented making extensive use of Markdown I advise you to jump into a topic and deep-dive in the calm seas of those playgrounds.
Please feel free to copy, share, and re-use the playgrounds as I always include an "I don't care" copyright, so I'm happy to donate my findings and results to the comunity without any loopholes. If you like you might mention where you stumbled across the idea and you might cite the original author(s), but that's certainly not a must.
Using the Playgrounds
All playgrounds are hosted and published on GitHub. So please feel free to either clone or fork them. If you want to see some additions you might write a comment and ask for such. If you have some suggestions for improvements, please feel free to write a comment or modify the code, and thereafter post a pull request.
Swift Playground
Topic
DNSResolve5
Resolve host names from a given IP address using Appleās Core Foundation with CFHost
. This wonāt resolve the host alias names, though
Factorial
Very simple demo of a recursion algorithm in Swift
Function Call Mapping
Demonstration of calling functions dynamically using a routing pattern
IPHostAddressResolution5
Resolve host names from a given IP address using GLibCās standard networking C function gethostbyaddr
. This does resolve the host alias names
IPHostAddressResolution5 SwiftUI
Same as IPHostAddressResolution5
with a simple UI
Pulsating Custom Button
A custom SwiftUI button with a blinking LED indicator mimicking buttons found on KORGās synthesisers
QR Code
How to platform-independently generate a bitmap QR code using Appleās CoreImage CIFilter
QR Code iOS
Same as QR Code
, specifically designed for i(Pad)OS
QR Code macOS
Same as QR Code
, specifically designed for macOS
SpeedMaths
A simple example of using a list view with a custom row content view with field-exit handler and context-dependent colouring
Syntax Tree
Demonstration of a tree algorithm adapted to the Swift programming language
Tail Recursion
Demonstration of the tail recursion algorithm adapted to the Swift programming language
Using Opaque Types
Demonstration of using Swift opaque types
Using Phantom Types
Demonstration of using phantom types in Swift
Last updated
Was this helpful?