{"id":13799774,"url":"https://github.com/danielpi/Swift-Playgrounds","last_synced_at":"2025-05-13T08:32:04.399Z","repository":{"id":69236348,"uuid":"20511767","full_name":"danielpi/Swift-Playgrounds","owner":"danielpi","description":"Learning Swift by working through example code in playgrounds","archived":false,"fork":false,"pushed_at":"2021-10-13T20:19:32.000Z","size":379,"stargazers_count":226,"open_issues_count":0,"forks_count":48,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-04-22T12:31:04.775Z","etag":null,"topics":["playground","swift","swift-playgrounds","swift-programming-language"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielpi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-06-05T04:26:20.000Z","updated_at":"2024-03-20T22:04:55.000Z","dependencies_parsed_at":"2023-02-27T23:45:59.348Z","dependency_job_id":null,"html_url":"https://github.com/danielpi/Swift-Playgrounds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpi%2FSwift-Playgrounds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpi%2FSwift-Playgrounds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpi%2FSwift-Playgrounds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpi%2FSwift-Playgrounds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielpi","download_url":"https://codeload.github.com/danielpi/Swift-Playgrounds/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253903862,"owners_count":21981761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["playground","swift","swift-playgrounds","swift-programming-language"],"created_at":"2024-08-04T00:01:05.959Z","updated_at":"2025-05-13T08:32:04.101Z","avatar_url":"https://github.com/danielpi.png","language":"Swift","funding_links":[],"categories":["Learning Swift"],"sub_categories":[],"readme":"# Swift Playgrounds\n\nSome experiments with Playgrounds in XCode 8.2 using the Swift programming language.\n\n## The Swift Programming Language Book\n\nI have been working through all the examples in the book Apple Inc. “The Swift Programming Language.” iBooks. https://itunes.apple.com/au/book/swift-programming-language/id881256329?mt=11. Each .playground file in the project relates to a chapter from the Swift Programming Language book.\n\nI have implemented this as a single XCode project that contains a playground file for each chapter of the language reference book. I'm finding it quite useful to have this project open when I am writing Swift code as I can use the project wide search functionality to lookup any Swift features or syntax that I am unsure about (so long as I can remember the words to look for)\n\nBelow is a list of each of the files within the project (this is also a list of the chapters of the book that I have worked through).\n\n- **A Swift Tour** contains the code from the \"Swift Tour\" chapter. It touches on most of the unusual features of the language and is easy to search through to find examples. It is a large file and does tend to give the swift interpreter a rather hard time.\n\nChapters from the Language guide. Each chapter goes into depth about its particular subject.\n\n- **The Basics** This chapter covers basic value types like Strings, Ints, Bools and floats. The notation for exponent values in float literals is interesting. Comments are covered (nested /* */ comment blocks). TypeAlias is covered as are tuples. Optionals are touched on and assertions are mentioned.\n- **Basic Operators** Arithmetic, remainder, increment, decrement, comparison, unary, ternary, range (closed and half-closed) and logical operators. There are examples of all of them.\n- **Strings And Characters** Some details about Unicode literals (multi-byte characters). The countElements() function for finding the length of a string. Concatenating strings, Comparing strings and Interpolating strings (not much on splitting or parsing strings). \n- **Collection Types**\n- **ControlFlow**\n- **Functions**\n- **Closures**\n- **Enumerations**\n- **Classes And Structures**\n- **Properties**\n- **Methods**\n- **Subscripts**\n- **Inheritance**\n- **Initialization**\n- **Deinitialization**\n- **Automatic Reference Counting**\n- **Optional Chaining**\n- **Type Casting**\n- **Nested Types**\n- **Extensions**\n- **Protocols**\n- **Generics**\n- **Advanced Operators**\n\n\n## Using Swift with Cocoa and Objective-C Book\nThere are six playground files that work through the code in the “Using Swift with Cocoa and Objective-C.” iBook. https://itunes.apple.com/au/book/using-swift-cocoa-objective/id888894773?mt=11. They are listed below. The example from this book didn't translate as well to the playgrounds as the previous book examples did. \n\n- **Basic Setup**\n- **Interacting With Objective-C-**\n- **Writing Classes With Objective C Behaviour**\n- **Working With Cocoa Data Types**\n- **Adopting Cocoa Design Patterns**\n- **InteractingWith C**\n\n\n## Swift Standard Library\nThe documentation for the Swift Standard Library can be found at the following link https://developer.apple.com/library/prerelease/ios/documentation/General/Reference/SwiftStandardLibraryReference/. There is a wealth of information contained in the standard library doc and it is nicely organised so that it is easy to experiment with in a playground environment. I have attempted to extend the examples somewhat to try and show off some of the other features of the standard library.\n\n- **String**\n- **Array**\n- **Dictionary**\n- **NumericTypes**\n- **Protocols**\n- **FreeFunctions**\n- **Undocumented**\n\n## Swift Blog\nThe Swift blog contains several articles detailing interesting information about the developing language. \n\n- **2014-08-15 Value and Reference Types**\n- **2014-08-05 Boolean**\n- **2014-07-28 Interacting with C Pointers**\n- **2014-07-23 Access Control**\n\n## NSHipster\nLots of great articles delving into the finer points of Cocoa programming. The recent articles on Swift are always interesting to go through\n\n- **2014-08-08 Swift Literal Convertibles** Shows how you can create types of your own that can be written as literals when you use them. \n\n# What next?\nHere are some links to other projects around the web that I would also like to implement\n- **Peter Norvig** has some great posts that delve into various programming topics. Mostly they are in Python though so it would be interesting to implement them in Swift.\n\t- http://norvig.com/spell-correct.html http://airspeedvelocity.net/2015/05/02/spelling/\n\t- http://nbviewer.ipython.org/url/norvig.com/ipython/TSPv3.ipynb\n- **Erica Sandun** Has a book out and also publishes a lot of information about Swift Playgrounds. In particular she is able to get impressive graphics, windows and user inputs to work, which is something that I haven't figured out yet.\n\t- http://ericasadun.com/2015/05/04/swift-using-functions-to-initialize-view-types/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpi%2FSwift-Playgrounds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielpi%2FSwift-Playgrounds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpi%2FSwift-Playgrounds/lists"}