├── .gitignore ├── projects ├── thenews-ipad.md ├── jazzy.md ├── Lo1Reader.md ├── VDOTRunner.md ├── yucatan.md ├── motionAlarm.md ├── TEMPLATE.md ├── card-deck.md ├── HockeyTweet.md ├── SwifterTracker.md ├── foursquift.md ├── swiftmesh.md ├── HausClock.md ├── ElksInbox.md ├── SwiftPack.md ├── nudges.md ├── analogAlarm.md ├── super-to-do.md ├── boris-the-blade.md ├── GatineauVélo.md ├── GiveAndTake.md ├── pressure.md ├── starbridge.md ├── Pythonic.swift.md ├── foggy.md ├── bluecap.md ├── krate.md ├── crump.md ├── Pomodoro.md ├── Bapit.md ├── SwiftThrift.md ├── The Oakland Post.md ├── HanekeSwift.md └── pinwheel.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .AppleDouble 3 | .LSOverride 4 | 5 | # Icon must end with two \r 6 | Icon 7 | 8 | 9 | # Thumbnails 10 | ._* 11 | 12 | # Files that might appear on external disk 13 | .Spotlight-V100 14 | .Trashes 15 | 16 | # Directories potentially created on remote AFP share 17 | .AppleDB 18 | .AppleDesktop 19 | Network Trash Folder 20 | Temporary Items -------------------------------------------------------------------------------- /projects/thenews-ipad.md: -------------------------------------------------------------------------------- 1 | # TheNews (iPad) 2 | 3 | ## Description 4 | 5 | I built (TheNews (iOS))[http://bit.ly/thenews-ios] & got loads of people asking for an iPad app so this is gonna be it. 6 | 7 | ## Project Location 8 | 9 | https://github.com/TosinAF/TheNews-iPad 10 | 11 | ## Updates 12 | 13 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 14 | 15 | ### July 10 16 | 17 | ### July 25 18 | 19 | ### August 10 20 | 21 | ### August 25 22 | 23 | ### September 10 24 | 25 | ### September 25 -------------------------------------------------------------------------------- /projects/jazzy.md: -------------------------------------------------------------------------------- 1 | # Jazzy 2 | 3 | ## Description 4 | 5 | Jazzy is a tool to generate documentation for Swift projects. Similar to appledoc in concept. 6 | 7 | ## Project Location 8 | 9 | https://github.com/realm/jazzy 10 | 11 | ## Team Members 12 | 13 | - JP Simard — @jpsim 14 | - Tim Anglade — @timanglade 15 | 16 | 17 | ## Updates 18 | 19 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 20 | 21 | ### July 10 22 | 23 | ### July 25 24 | 25 | ### August 10 26 | 27 | ### August 25 28 | 29 | ### September 10 30 | 31 | ### September 25 -------------------------------------------------------------------------------- /projects/Lo1Reader.md: -------------------------------------------------------------------------------- 1 | # Law Of One Reader 2 | 3 | ## Description 4 | 5 | An offline reading app for the Law Of One channeling sessions by L/L Research (http://www.llresearch.org/). 6 | 7 | ## Project Location 8 | 9 | https://github.com/ebierman/Lo1Reader 10 | 11 | ## Team Members 12 | 13 | Eli Bierman - @ebierman 14 | 15 | ## Updates 16 | 17 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 18 | 19 | ### July 10 20 | 21 | ### July 25 22 | 23 | ### August 10 24 | 25 | ### August 25 26 | 27 | ### September 10 28 | 29 | ### September 25 30 | -------------------------------------------------------------------------------- /projects/VDOTRunner.md: -------------------------------------------------------------------------------- 1 | # VDOTRunner 2 | 3 | ## Description 4 | Tool for helping runners on finding out their interval pacing. 5 | 6 | 7 | ## Project Location 8 | 9 | http://github.com/SuperTango/VDOTRunner 10 | 11 | ## Team Members 12 | 13 | - Alex Tang 14 | - Matt Sutton 15 | - Eric Chung 16 | - Julie Youn 17 | 18 | 19 | ## Updates 20 | 21 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 22 | 23 | ### July 10 24 | 25 | ### July 25 26 | 27 | ### August 10 28 | 29 | ### August 25 30 | 31 | ### September 10 32 | 33 | ### September 25 34 | -------------------------------------------------------------------------------- /projects/yucatan.md: -------------------------------------------------------------------------------- 1 | # The Yucatan Trail 2 | 3 | ## Description 4 | 5 | A semi-faithful clone of The Oregon Trail, but with content based on a certain 2013 workcation in Mexico... 6 | 7 | ## Project Location 8 | 9 | TBA 10 | 11 | ## Team Members 12 | 13 | Paul Collier - @pshc 14 | Gwendolyn Weston - @gwendolynw 15 | 16 | ## Updates 17 | 18 | ### July 10 19 | It is 2014. Your jumping off place for ~/yucatan-trail/ is Xcode 6, Beta 3. You must decide which language to use. 20 | 21 | 1. Objective-C 22 | 2. Swift 23 | 24 | What is your choice? 2 25 | 26 | ### July 25 27 | 28 | ### August 10 29 | 30 | ### August 25 31 | 32 | ### September 10 33 | 34 | ### September 25 -------------------------------------------------------------------------------- /projects/motionAlarm.md: -------------------------------------------------------------------------------- 1 | # Motion Alarm 2 | 3 | ## Description 4 | 5 | Alarm that only turns off if you walk 10 steps, to help you avoid hitting snooze every morning. 6 | 7 | ## Project Location 8 | 9 | TBD - Most likely https://github.com/yoshyosh/motionAlarm soon 10 | 11 | ## Team Members 12 | 13 | - Ben Morrow — [@benmorrow](https://github.com/benmorrow) 14 | - Joe Anderson — [@yoshyosh](https://github.com/yoshyosh) 15 | 16 | ## Updates 17 | 18 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 19 | 20 | ### July 10 21 | 22 | Finished initial prototype at swift hackathon 23 | 24 | ### July 25 25 | 26 | ### August 10 27 | 28 | ### August 25 29 | 30 | ### September 10 31 | 32 | ### September 25 -------------------------------------------------------------------------------- /projects/TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | ## Description 4 | 5 | 6 | 7 | ## Project Location 8 | 9 | 10 | 11 | ## Team Members 12 | 13 | - 14 | - 15 | - 16 | 17 | 18 | ## Updates 19 | 20 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 21 | 22 | ### July 10 23 | 24 | ### July 25 25 | 26 | ### August 10 27 | 28 | ### August 25 29 | 30 | ### September 10 31 | 32 | ### September 25 33 | -------------------------------------------------------------------------------- /projects/card-deck.md: -------------------------------------------------------------------------------- 1 | # Deck 2 | 3 | ## Description 4 | 5 | Card Deck is a deck of cards for your iPhone. 6 | 7 | ## Project Location 8 | 9 | [carddeck.co](http://carddeck.co/) 10 | 11 | ## Team Members 12 | 13 | - Zane Shannon -- zshannon -- @zaneshannon 14 | 15 | 16 | ## Updates 17 | 18 | ### July 15 19 | Just heard about the Summer of Swift. This idea's been rattling around in my head for months. Seems like the right opportunity. Here goes! 20 | 21 | ### July 26 22 | Spent a while watching the WWDC '14 Swift talks and reading Apple's The Swift Programming Language iBook. Modelled a Card and a Deck of Cards in Swift. Setup TableViewControllers to debug the models. 23 | 24 | ### August 10 25 | 26 | ### August 25 27 | 28 | ### September 10 29 | 30 | ### September 25 31 | -------------------------------------------------------------------------------- /projects/HockeyTweet.md: -------------------------------------------------------------------------------- 1 | # HockeyTweet 2 | 3 | ## Description 4 | 5 | Originally written in 2009 as a way to teach myself iOS programming I thought what better way to learn Swift than to dust off this old app and rewrite it in Swift. I don't expect to rerelease the app again since I think the Twitter app landscape, autocompletion, and predictive text have changed so much since the app was first released. 6 | 7 | ## Project Location 8 | 9 | https://github.com/mthistle/HockeyTweetSwift 10 | 11 | ## Team Members 12 | 13 | - Mark Thistle — @mthistle 14 | 15 | ## Updates 16 | 17 | ### July 14 18 | 19 | - Pushed to github 20 | 21 | ### July 25 22 | 23 | ### August 10 24 | 25 | ### August 25 26 | 27 | - Updated to work with Xcode 6 Beta 5 28 | 29 | ### September 10 30 | 31 | ### September 25 32 | -------------------------------------------------------------------------------- /projects/SwifterTracker.md: -------------------------------------------------------------------------------- 1 | # Swifter Tracker 2 | 3 | ## Description 4 | 5 | Swifter Tracker helps you bookmark content for easy access while on the go! 6 | 7 | For example, keep track of YouTube videos that you can play while multitasking. 8 | 9 | Catch up on Taylor Swift music videos while driving! (But you might want to keep your eyes on the road.) 10 | 11 | ## Project Location 12 | 13 | https://github.com/xke/SwifterTracker 14 | 15 | ## Author 16 | 17 | @xke 18 | 19 | ## Updates 20 | 21 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 22 | 23 | 24 | ### July 25 25 | initial creation of a few template filez. 26 | 27 | ### August 10 28 | hello! no news for now. 29 | 30 | ### August 25 31 | 32 | ### September 10 33 | 34 | ### September 25 35 | -------------------------------------------------------------------------------- /projects/foursquift.md: -------------------------------------------------------------------------------- 1 | # Foursquift 2 | 3 | ## Description 4 | 5 | Foursquare is THE location layer of the internet. There is a nearly limitless amount of information available through their well organized data API and 6 | the company strongly supports apps and products that utilize their data in unique ways. 7 | 8 | Foursquift is a Swift wrapper around the API that takes advantage of the great new features of 9 | Swift's collection enhancements. It is a framework that will have great exposure and tons of support. 10 | 11 | Outside help is welcome. 12 | 13 | ## Project Location 14 | 15 | https://github.com/rodericj/Foursquift 16 | 17 | ## Team Members 18 | 19 | - Roderic Campbell - github: rodericj twitter: @roderic 20 | 21 | 22 | ## Updates 23 | 24 | 25 | ### July 10 26 | 27 | ### July 25 28 | 29 | ### August 10 30 | 31 | ### August 25 32 | 33 | ### September 10 34 | 35 | ### September 25 36 | -------------------------------------------------------------------------------- /projects/swiftmesh.md: -------------------------------------------------------------------------------- 1 | # SwiftMesh 2 | 3 | ## Description 4 | 5 | SwiftMesh is a data structure for polygonal meshes. The goal is to explore Swift's ability to efficiently deal with various types of mesh manipulations. 6 | 7 | ## Project Location 8 | 9 | https://github.com/porumbes/swiftmesh 10 | 11 | ## Team Members 12 | 13 | - Serban Porumbescu - [@porumbes on github](https://github.com/porumbes), [@serban on twitter](http://twitter.com/serban) 14 | 15 | ## Updates 16 | 17 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 18 | 19 | ### July 25 20 | 21 | * Worked through "A Swift Tour" and general reading of _The Swift Programming Language_ 22 | * Started designing SwiftMesh components based on OpenMesh 23 | * Review of generative programming techniques 24 | 25 | ### August 10 26 | 27 | ### August 25 28 | 29 | ### September 10 30 | 31 | ### September 25 -------------------------------------------------------------------------------- /projects/HausClock.md: -------------------------------------------------------------------------------- 1 | # Hausclock 2 | 3 | ## Description 4 | 5 | HausClock is a minimal chess clock. It will have a focus on usability and sweet animations. 6 | 7 | I'm going to use it to play [bughouse](http://en.wikipedia.org/wiki/Bughouse_chess) and drink whiskey. 8 | 9 | ![Mockup](https://d13yacurqjgara.cloudfront.net/users/26051/screenshots/1633998/mockup.png) 10 | 11 | ## Project Location 12 | 13 | https://github.com/nottombrown/HausClock 14 | 15 | ## Team Members 16 | 17 | - Tom Brown - github: nottombrown, twitter: @nottombrown 18 | 19 | ## Updates 20 | 21 | ### July 10 22 | 23 | - Made [fancy mockup](https://dribbble.com/shots/1633998-Chess-Clock?list=users&offset=0) 24 | - Initialized git repo 25 | - Wrote [blog post on optionals](http://www.nottombrown.com/blog/2014/07/12/swift-for-rubyists-optionals/) 26 | - ENTERED THIS CONTEST!!! 27 | 28 | ### July 17 29 | 30 | - App compiles and displays basic clock 31 | - App counts down correctly 32 | 33 | ### July 24 34 | -------------------------------------------------------------------------------- /projects/ElksInbox.md: -------------------------------------------------------------------------------- 1 | # ElksInbox 2 | 3 | ## Description 4 | 5 | Sometimes it's nice to be able to send and receive SMS messages directly from your Mac. ElksInbox is a graphical OSX tool that allows you to do just that. 6 | 7 | I want to learn doing UI programming and HTTP API integration in Swift, so this was the perfect application for me to build as I can use my existing knowledge of the 46elks API and thus focus on learning Swift. 8 | 9 | ## Project Location 10 | 11 | https://github.com/johannesl/ElksInbox 12 | 13 | Development is done in Uppsala, Sweden. 14 | 15 | ## Team Members 16 | 17 | - Johannes Lundberg — johannesl@46elks.com 18 | 19 | ## Updates 20 | 21 | ### July 9 22 | 23 | I'm roughly setting up the project repo and figuring out how to best commit a Swift project to github without bloat. 24 | 25 | ### July 28 26 | 27 | Added layout mockup both as a screenshot and in Balsamiq Mockups BMML format. 28 | 29 | ### September 15 30 | 31 | Base layout code commited.. Warming up! 32 | 33 | ### September 25 34 | 35 | -------------------------------------------------------------------------------- /projects/SwiftPack.md: -------------------------------------------------------------------------------- 1 | # SwiftPack 2 | 3 | ## Description 4 | 5 | SwiftPack is a MsgPack library 6 | 7 | ## Project Location 8 | 9 | https://github.com/briandw/SwiftPack 10 | 11 | ## Team Members 12 | 13 | - Brian Williams — @briandw 14 | 15 | ## Updates 16 | 17 | ### July 12 18 | Added the first version of the packer (the unpacker was already done) 19 | 20 | ### July 26 21 | Fixed the packer and updated for the latest Xcode 22 | 23 | ### August 10 24 | Switched to a Mac App. Updated to latest Xcode, but strings are still broken. 25 | 26 | ### August 17 27 | Fixed the byte array to string conversion that Xcode-Beta5 broke. Using withUnsafeBufferPointer to access the byte pointer. Have a look at Unpacker -> stringFromSlice for an example. 28 | 29 | ### August 25 30 | Updated for Xcode-Beta6. Removed stringFromSlice and replaced it with String.stringWithBytes(bytes: encoding:NSUTF8StringEncoding). Also switched the packer to using string.utf8 to get the string bytes. 31 | 32 | ### September 7 33 | Changed the project to build SwiftPack as a separate framework/module from the Application and tests. 34 | 35 | ### September 25 -------------------------------------------------------------------------------- /projects/nudges.md: -------------------------------------------------------------------------------- 1 | # Nudges 2 | 3 | ## Description 4 | 5 | Nudges is a simple reminders app that won't induce guilt. 6 | 7 | Grayson and I built an initial version of this last year to coincide with the iOS 7 release, but haven't really worked on it in the last year since we got it into the App Store. 8 | 9 | In order to learn about Swift and new iOS 8 APIs, we're going to re-write Nudges completely using Swift/CloudKit. 10 | 11 | ## Project Location 12 | 13 | [@nudgemeabout](https://twitter.com/nudgemeabout) 14 | 15 | ## Team Members 16 | 17 | - Stephen Birarda — @birarda 18 | - Grayson Stebbins — @problem 19 | 20 | ## Updates 21 | 22 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 23 | 24 | ### August 10 25 | 26 | Finally got started this week! 27 | 28 | * Discussed featureset for 1.0 release 29 | * Updated interface 30 | * Recurring Nudges 31 | * Nudge me again (snooze) 32 | * @problem familiarized himself with PaintCode 33 | * @birarda familiarized himself with Swift and iOS 8 adaptive layouts 34 | * Created base of first view controller (top time bar with updating time) -------------------------------------------------------------------------------- /projects/analogAlarm.md: -------------------------------------------------------------------------------- 1 | # Analog Alarm 2 | 3 | ## Description 4 | 5 | Set alarms using an analog clock. 6 | 7 | ## Project Location 8 | 9 | 10 | 11 | ## Team Members 12 | 13 | - David Kobilnyk 14 | 15 | 16 | ## Updates 17 | 18 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 19 | 20 | ### July 14 21 | 22 | Completed a basic analog clock with ability to set hour and minute by touching and dragging the hour and minute hands. 23 | 24 | Gained a bit more skill with core graphics usage.
25 | Used operator overloading to add/multiply numbers with CGPoint.
26 | Created and implemented a custom delegate. 27 | 28 | Enjoyed the math for determining where the hand should be drawn and which hour or minute was selected based on touch position.
29 | Had some issues with number types -- seems like I had to typecast to CGFloat ridiculously frequently to avoid errors like "'NSNumber' is not a subtype of 'UInt8'" (even when there wasn't a UInt8 present). 30 | 31 | ### July 25 32 | 33 | ### August 10 34 | 35 | ### August 25 36 | 37 | ### September 10 38 | 39 | ### September 25 40 | -------------------------------------------------------------------------------- /projects/super-to-do.md: -------------------------------------------------------------------------------- 1 | # Super To-Do 2 | 3 | ## Description 4 | 5 | In this project I will be building a To Do app with extra features, such as: 6 | 7 | * Folders for sorting to-do's 8 | * Alarm Reminders 9 | * Push notifications 10 | * Core Data 11 | * Push notifications 12 | * Assigning To-Do's to others 13 | 14 | ## Project Location 15 | 16 | http://www.github.com/dunphyben/todo_sos 17 | 18 | ## Team Members 19 | 20 | - Benjamin Dunphy — github.com/dunphyben | @benghamine 21 | - 22 | 23 | ## Updates 24 | 25 | ### July 12 26 | 27 | Attended the SLUG Swift class + Hackday in San Francisco on July 12. A good introduction to Swift. My team built a sort of flappy bird clone with doge, called [Hoppy Doge](http://github.com/dunphyben/gamerunner). 28 | 29 | A fellow hacker, Evan Ku, presented a cool To-Do app using core data. This really piqued my interest and I thought it might be useful to the development of Super To-Do. Evan was kind enough to offer me his code for study. I will be reviewing it for my next update. 30 | 31 | ### July 25 32 | 33 | ### August 10 34 | 35 | ### August 25 36 | 37 | ### September 10 38 | 39 | ### September 25 -------------------------------------------------------------------------------- /projects/boris-the-blade.md: -------------------------------------------------------------------------------- 1 | # Boris the Blade 2 | 3 | ## Description 4 | 5 | Framework for using [Xcode Playgrounds][1] in your own app. 6 | 7 | First of all, it would be really awesome to have Playgrounds inside your presentation software to execute live code, similar to what [showoff][4] already does for JS and Ruby. 8 | 9 | Second reason for doing this is exploring how the more dynamic parts of the Objective-C runtime can effectively be used in Swift and what features might not work at this point. 10 | 11 | ## Project Location 12 | 13 | 14 | 15 | ## Team Members 16 | 17 | - Boris Bügling - Twitter: [@NeoNacho][2] / GitHub: [@neonichu][3] 18 | 19 | ## Updates 20 | 21 | ### July 7 22 | 23 | First minimal version of this was done during SwiftCrunch. The framework works to the point of opening the Playgrounds editor inside any app, but crashes when typing because SourceKit isn't properly set up, yet. 24 | 25 | ### July 10 26 | 27 | ### July 25 28 | 29 | ### August 10 30 | 31 | ### August 25 32 | 33 | ### September 10 34 | 35 | ### September 25 36 | 37 | 38 | [1]: https://developer.apple.com/library/prerelease/ios/recipes/xcode_help-source_editor/ExploringandEvaluatingSwiftCodeinaPlayground/ExploringandEvaluatingSwiftCodeinaPlayground.html 39 | [2]: https://twitter.com/NeoNacho 40 | [3]: https://github.com/neonichu 41 | [4]: https://github.com/puppetlabs/showoff 42 | -------------------------------------------------------------------------------- /projects/GatineauVélo.md: -------------------------------------------------------------------------------- 1 | # GatineauVélo 2 | 3 | ## Description 4 | 5 | [https://github.com/philippec/GatineauVelo](This application) displays the bike paths for the City of Gatineau, and makes a good sample app for test-driven development. 6 | 7 | I'd like to rewrite it in Swift to compare and contrast, as the original was built in only a few hours. 8 | 9 | ## Project Location 10 | 11 | ### Work in progress: 12 | https://github.com/philippec/GatineauSwift 13 | 14 | ### Main project 15 | https://github.com/philippec/GatineauVelo 16 | 17 | ## Team Members 18 | 19 | - Philippe Casgrain — @philippec 20 | 21 | 22 | ## Updates 23 | 24 | ### July 10 25 | 26 | * Created project skeleton 27 | * Created three base classes 28 | * Created first real unit test (testCreation, woooo) 29 | 30 | ### July 25 31 | 32 | * Took a different approach to the migration: trying one class at a time, with a hybrid ObjC-Swift project 33 | * Successfully replaced an Objective-C class with an equivalent Swift class and it works! 34 | * The unit test class, however, was not able to see the new Swift class because the Unit Test target lacked the generated header 35 | * Filed rdar://problem/17851745 to address this issue 36 | 37 | ### August 10 38 | 39 | * No significant progress due to vacation 40 | * radar came back as duplicate, but the issue was mentioned in b5 release notes with "do your unit tests in swift" as a workaround... 41 | 42 | ### August 25 43 | 44 | ### September 10 45 | 46 | ### September 25 47 | -------------------------------------------------------------------------------- /projects/GiveAndTake.md: -------------------------------------------------------------------------------- 1 | # Give and Take 2 | 3 | ## Description 4 | 5 | Pre-iOS 8, many apps synced their documents to Dropbox to enable their 6 | documents to be accessed in other apps. iOS 8 allows such apps to 7 | access Dropbox-like services through Document Provider extensions. 8 | 9 | This Swift project aims to provide examples of: 10 | 11 | 1. A document provider extension 12 | 2. An app accessing documents from a document provider extension 13 | 14 | [Apple's example][NewBox] is not adequately illuminating (and is not in 15 | Swift :)), hence this effort. 16 | 17 | PRs are welcome. Also welcome are discoveries about iOS 8 document 18 | picker design and usage. 19 | 20 | [NewBox]: https://developer.apple.com/library/prerelease/ios/samplecode/NewBox/ 21 | 22 | ## Project Location 23 | 24 | 25 | 26 | ## Team Members 27 | 28 | - Roopesh Chander 29 | - Github: [@roop](https://github.com/roop/) 30 | - Twitter: [@roopeshchander](https://twitter.com/roopeshchander) 31 | 32 | ## Updates 33 | 34 | ### July 14 35 | 36 | - Plan is to make two apps: 37 | 1. **Give app:** 38 | - This will become the app that includes a document provider extension 39 | - Now has a minimal UI for creating simple text files to be exposed 40 | through the extension 41 | 2. **Take app:** 42 | - This will be the app that invokes UIDocumentPickerViewController to 43 | open a document from Give 44 | - Work on this app has not started yet 45 | 46 | ### July 25 47 | 48 | ### August 10 49 | 50 | ### August 25 51 | 52 | ### September 10 53 | 54 | ### September 25 55 | -------------------------------------------------------------------------------- /projects/pressure.md: -------------------------------------------------------------------------------- 1 | # Pressure 2 | 3 | ## Description 4 | 5 | Buttons that respond to the [majorRadius value](https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UITouch_Class/index.html#//apple_ref/occ/instp/UITouch/majorRadius) that was introduced to iOS 8. 6 | 7 | ## Project Location 8 | 9 | https://github.com/ricburton/pressure 10 | 11 | ## Team Members 12 | 13 | - Richard Burton — [@ricburton](https://github.com/ricburton) 14 | - Sam Duke — [@samskiter](https://github.com/samskiter) 15 | 16 | ## Updates 17 | 18 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 19 | 20 | ### July 10 21 | 22 | I checked out [this](http://stackoverflow.com/questions/24397927/where-to-find-information-on-ios-8-variable-touch-sizing-api) Stack Overflow answer on the touch pressure implementation and started playing around with the code in a Playground. I also mocked up a couple of ideas for how buttons could respond to pressure. 23 | 24 | ![A couple of button ideas](http://f.cl.ly/items/3p30382b3s3M2c2Y0O0Q/Screen%20Shot%202014-07-10%20at%2011.18.07.png) 25 | 26 | ### July 25 27 | 28 | We now have a basic prototype working that prints out the majorRadius of the touch event. 29 | 30 | ![Prototype Pressure](http://f.cl.ly/items/2F3u2y050S2P2S3U2g3n/Screen%20Shot%202014-07-24%20at%2010.21.14.png) 31 | 32 | ### August 10 33 | 34 | I've now started messing around with interface design using Playgrounds. 35 | 36 | ![Prototype Pano](http://cl.ly/image/2n2I2A2X0d1V/Screen%20Shot%202014-08-07%20at%2018.38.09.png) 37 | 38 | ### August 25 39 | 40 | ### September 10 41 | 42 | ### September 25 43 | -------------------------------------------------------------------------------- /projects/starbridge.md: -------------------------------------------------------------------------------- 1 | # StarBridge 2 | 3 | ## Description 4 | 5 | Inspired by games like FTL and Spacrteam, and board games like Space Cadets and Galaxy Trucker, I want to make a fun and fast starship simulator for multiple players. It will use AirPlay to turn an Apple TV into the viewport, and every device will be a a different console on the bridge. 6 | 7 | I’ll be writing the project in Swift, and taking advantage of many of the new SpriteKit features in iOS 8. Also multipeer connectivity and possibly diving into some SceneKit to make it fancier. 8 | 9 | Name is currently under construction. 10 | 11 | ## Project Location 12 | 13 | @stevethomp 14 | 15 | ## Team Members 16 | 17 | - Steven — github: stevethomp twitter: @stevethomp 18 | 19 | 20 | ## Updates 21 | 22 | 23 | ### July 15 24 | I added basic Multipeer (Thanks JP and MPCMultipeerClient) and am working on getting basic notifications and communication between the different devices working. I'm also trying to decide on final game design, with a focus on how a game will work and what each station will be doing. 25 | 26 | The name is still terrible and in progress. 27 | 28 | ### July 29 29 | I have basic airplay working, and a rough idea of what each station will do. I wasn't able to make much progress but have some simple frameworks and foundations laid out. 30 | 31 | Next steps: 32 | - Get multipeer running and passing events 33 | - Get logic working in GameManager to deal with events, and pass them to appropriate devices 34 | - Implement four stations with simple gameplay 35 | - Add enemy ships and 'adventure' mode 36 | 37 | ### August 11 38 | I unfortunately didn't have a chance to anything other than keep the project building with current betas. 39 | 40 | ### August 26 41 | I had a chance to make some progress, and am feeling pretty good. I settled on a basic game, and what each station will do. I have Helm almost fully functional, although my math is wrong sometimes. 42 | 43 | Multipeer connectivity is the big challenge now. I have two iOS 8 devices so I can test, and hopefully will have that going by the next update. 44 | 45 | ### September 10 46 | 47 | ### September 25 -------------------------------------------------------------------------------- /projects/Pythonic.swift.md: -------------------------------------------------------------------------------- 1 | # Pythonic.swift 2 | 3 | ## Description 4 | 5 | Pythonic.swift is a Swift library implementating selected parts of Python's standard library and making them available to your Swift code. 6 | 7 | ```import Pythonic``` allows you to write Python flavored code such as: 8 | 9 | ``` 10 | #!/usr/bin/env xcrun swift -i -I . 11 | 12 | import Pythonic 13 | 14 | var strings = ["foo", "bar"] 15 | if strings { 16 | println(strings[0]) // foo 17 | } 18 | if len(strings) == 2 { 19 | println(strings[1].upper()) // BAR 20 | } 21 | 22 | var greeting = " hello pythonista " 23 | if greeting.strip().startswith("hello") { 24 | println(greeting.strip().title()) // Hello Pythonista 25 | } 26 | 27 | var numbers = [1, 2, 3, 4, 5] 28 | println(sum(numbers)) // 15 29 | println(max(numbers)) // 5 30 | ``` 31 | 32 | ## Project Location 33 | 34 | https://github.com/practicalswift/Pythonic.swift 35 | 36 | ## Team Members 37 | 38 | -
@practicalswift (https://twitter.com/practicalswift, http://practicalswift.com/) 39 | 40 | ## Updates 41 | 42 | ### July 10 43 | 44 | Continued implementing functions from the Python standard library in Swift. 45 | 46 | Posted a "Show HN" on the project which reached the first page of HN for a couple of hours (https://news.ycombinator.com/item?id=8001245). 47 | 48 | Learned about the smart `GeneratorOf` class, which allows for easy creation of generators which are needed when implementing the `Sequence` protocol. 49 | 50 | A Sequence allows for the `for x in [sequence]` in Swift. This is an example of a `generate()` function using `GeneratorOf`. 51 | 52 | ``` 53 | func generate() -> GeneratorOf { 54 | var i = 0 55 | var lines = self.readLines().map { $0 + "\n" } 56 | return GeneratorOf { 57 | if i >= len(lines) { 58 | return .None 59 | } else { 60 | return lines[i++] 61 | } 62 | } 63 | } 64 | ``` 65 | 66 | Call for contributors: Please join me in implementing the Python standard library in Swift. It is really fun, and you'll learn a lot about Swift during the process! :-) 67 | 68 | ### July 25 69 | 70 | ### August 10 71 | 72 | ### August 25 73 | 74 | ### September 10 75 | 76 | ### September 25 77 | -------------------------------------------------------------------------------- /projects/foggy.md: -------------------------------------------------------------------------------- 1 | # Foggy 2 | 3 | ## Description 4 | 5 | Foggy will be a SpriteKit game written in Swift. The gameplay will make use of iOS8's fun new SKFieldNodes. 6 | 7 | ## Project Location 8 | 9 | https://github.com/jsvatek/Foggy 10 | 11 | ## Team Members 12 | 13 | - Josh Svatek — @jsvatek 14 | 15 | ## Updates 16 | 17 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 18 | 19 | ### July 25 20 | 21 | A lot of getting to know SpriteKit particles and SKFieldNodes. Setting strange regions with constructive set geometry seems to work very well. Am hoping for more Swift-specific illumination to share in future updates -- although I will say not having .h and .m files vying for pixels on my 13" mpb is an insufficiently sung feature. 22 | 23 | ### Aug 13 24 | 25 | So: My wife hates snowboarding because she's a good skier. She's far sportier than me, and no doubt would be a much better snowboarder if she gave it a fair shake, but she just hates being a noob on the hill. I don't downhill ski, so this never bothered me. 26 | 27 | I've been having a hard time with Swift recently. Flaky debugger, scant documentation, and constant struggle trying to write 'nice Swift'. I feel like every time I invest a serious stretch of time into trying to advance my summer project, I end up getting caught up in minutia, trying to find a 'nice' way to accomplish something I already know how to do. 28 | 29 | I think what helped me last night was to stop trying so hard. I am a beginner. There's a lot I don't know. It's hubristic to shoot for elegance when I don't have the experience to back up that desire. It's a particular trap because the markers of elegance that I'm used to, the tell-tales of craftmanship that signify competence in Objective-C might be completely wrong in Swift, and I'm spending a lot of fruitless time trying to literally reimplement them in this new language. 30 | 31 | Realizing this made me feel a lot better. It's a balance, but I'm going to embrace my inner spaghetti code monster. Time to write some bad code. 32 | 33 | Just as a footnote to the aether... One of the things that scared the pants off me about Swift was the fact that it represented a break from the truly remarkable community and best practices that surround Objective-C. I'm afraid of developers that weren't weaned on Aaron Hillegass. I wonder if this fear is part of the push towards identifying 'nice' (or 'idiomatic', 'pure' or 'elegant') Swift. But in any case, I think it will do a world a good to let it go. It's too early. I certainly need to spend more time accumulating scrapes in the playground first. 34 | -------------------------------------------------------------------------------- /projects/bluecap.md: -------------------------------------------------------------------------------- 1 | # BlueCap 2 | 3 | ## Description 4 | 5 | BlueCap provides a swift wrapper around Core Bluetooth with additional functionality that includes, 6 | 7 | - Closure callbacks to replace protocol implementation for Central Manager peripheral, service and characteristic discovery, characteristic read and write and characteristic value update notifications. Similarly, for Peripheral Managers closures are provided for advertising and characteristic write callbacks. 8 | 9 | - Connectorators and Scannerators provide management of peripheral scan and connection events. Timeouts for connection, scanning, read and write. 10 | 11 | - A DSL for specification of GATT profiles. Bluetooth LE device manufactures can provide implementations of their GATT profiles for distribution to developer and developers can easily implement GATT profiles for their Bluetooth LE devices. 12 | 13 | - Characteristic profile types encapsulating serialization and deserialization of values. Provided types include: Strings, Byte, Int8, UInt16, Int16 and Enum , Structs and more. New types can be added by users. Implementations of characteristic profiles for [TI Sensor tag](http://www.ti.com/ww/en/wireless_connectivity/sensortag/index.shtml?DCMP=PPC_Google_TI&k_clickid=1f619e48-1938-ba89-3b95-000078cf17fd), some [BLESIG GATT Profiles](https://developer.bluetooth.org/TechnologyOverview/Pages/Profiles.aspx) and more. 14 | 15 | - A peripheral scanner application provides and example implementation of a Central Manager and a peripheral emulator an example implementation of a Peripheral Manager. 16 | 17 | ## Project Location 18 | 19 | https://github.com/troystribling/BlueCap 20 | 21 | ## Team Members 22 | 23 | - Troy Stribling - github: troystribling, twitter: @troystribling 24 | 25 | ## Updates 26 | 27 | ### July 3 28 | 29 | - Peripheral scanning and discovery completed. 30 | - Peripheral Connectorator completed 31 | - Service Discovery completed. 32 | - Characteristic Discovery completed. 33 | 34 | ### July 10 35 | 36 | - Serialization/Deserialization and Endianness conversion interfaces completed with implementations for Enums and Ints. 37 | - Characteristic profiles for Enums and Ints completed. 38 | 39 | ### July 22 40 | - Characteristic read and write completed. 41 | - Characteristic notifications completed. 42 | 43 | ### August 7 44 | - Completed TI Sensor Tag Service Profile implementations and other examples. 45 | - Completed struct, pair struct and String Characteristic Profile types. 46 | - Completed Characteristic Profile browser. 47 | 48 | ### August 21 49 | - Completed Peripheral Manager, Mutable Service and Mutable Characteristic implementations. 50 | - Completed Peripheral Simulator. 51 | 52 | ### September 6 53 | - Completed Location and Region managers. 54 | - Started scan configuration. Completed views for scan mode configuration, scan services configuration and region initiated scan configuration. 55 | 56 | ### September 20 57 | - Completed scan configuration. Supported modes are Promiscuous and service scan. Region scannerator completed. 58 | - Started iBeacon support 59 | 60 | ### September 27 61 | - Completed iBeacon support. 62 | 63 | ### October 4 64 | - Completed PeripheralManager service advertisement. 65 | - Completed PeripheralManager iBeacon configuration. 66 | -------------------------------------------------------------------------------- /projects/krate.md: -------------------------------------------------------------------------------- 1 | # Krate - Create and Destroy 2 | 3 | ## Description 4 | 5 | Krate is a fresh twist on gem puzzle games, featuring a spinning board; creeping evil, powerful combos and tough choices. Most of all, my goal is that Krate will entertain and reward players. 6 | 7 | This is my summer Swift learning project, born through the fortuitous coincidence of the Swift announcement with the Spring semester’s end. 8 | 9 | ## Project Location 10 | 11 | http://www.thinkingswiftly.com/category/krate-iphone-game/ 12 | 13 | ## Team Members 14 | 15 | - Stephen Haney - Blog: [Thinking Swiftly][1] - GitHub: [@StephenHaney][2] - Twitter: [@sdothaney][3] 16 | 17 | ## Updates 18 | 19 | ### July 8th 20 | Basic gameplay mechanics implemented with colorful blocks! 21 | 22 | ### July 10 23 | Krate saw terrific advancement this week! [I wrote a summary of work here.](http://www.thinkingswiftly.com/krate-advancing-leaps-bounds/) 24 | 25 | **Quick updates list:** 26 | - Placeholder graphics 27 | - Sound management system (with some placeholders) 28 | - I created a [Backbone.js style events manager for Swift](https://github.com/StephenHaney/Swift-Custom-Events) (Please check it out and help make it better!) 29 | - Added many new game mechanics 30 | 31 | It'll be hard to match this pace in the future, but I'm happy with what was accomplished. 32 | 33 | **[Check out a gameplay video on my blog!](http://www.thinkingswiftly.com/krate-advancing-leaps-bounds/)** 34 | 35 | ![Krate with Kenney graphics](http://www.thinkingswiftly.com/wp-content/uploads/2014/07/graphics.jpg) 36 | 37 | ### July 25 38 | More steady progress on Krate over the past two weeks. [I wrote a blog post about increasing 'skill cap'](http://www.thinkingswiftly.com/raising-skill-cap-hinting-upcoming-events/) and some of the things I'm working on in Krate to do just that. 39 | 40 | **[Here's a video of the new HUD](https://www.youtube.com/watch?v=xQIhELP75Ys)** which lets players see their upcoming color choices. 41 | 42 | ![Krate's Upcoming Colors](http://www.thinkingswiftly.com/wp-content/uploads/2014/07/upcoming-colors.png) 43 | 44 | Also, started work on the point system! Work was pretty full, so I'm hoping to have more time in August to push forward. 45 | 46 | ### August 10 47 | I was able to dive in the last few days and implement levels (so the game increases in tempo and difficulty) very much like Tetris. Also, big combos now clear out one "dead" tile. Plus a variety of other mechanical changes. Visually, the game looks very much like last update so I'll skip another video for this round. 48 | 49 | The great news is all of my basic game systems are in place and my mechanics are very close to being complete. I hope to have the gameplay finished and locked in by the August 25th update. I'll use the final month to find an artist and implement all the extras like menus and leaderboards. 50 | 51 | ### August 25 52 | The summer's chugging right along! Krate is on track. Gameplay is basically wrapped. I've created some design documents and am currently searching for the right artist to add some polish and atmosphere! A local musician is contributing some tunes. Everything's coming together! 53 | 54 | I also participated in LudumDare this past weekend, which is a 48 hour game making contest. I made a feel-good, silly game, and I'm really proud of how polished it is for 48 hours. You can play my entry here: http://www.thinkingswiftly.com/starlight/ 55 | 56 | ### September 10 57 | 58 | ### September 25 59 | 60 | [1]: http://www.thinkingswiftly.com 61 | [2]: https://github.com/StephenHaney 62 | [3]: https://twitter.com/sdothaney -------------------------------------------------------------------------------- /projects/crump.md: -------------------------------------------------------------------------------- 1 | # Crump 2 | 3 | ## Description 4 | 5 | Crump is an arcade game with 80s style play based around OS X, keyboard input, tmx (Tiled) tile maps, and SpriteKit. The exact details of the gameplay are still a work in progress but enemy avoidance, constant movement withn a grid, and collection will be its essential elements. 6 | 7 | ## Project Location 8 | 9 | https://github.com/davecom/Crump 10 | 11 | ## Team Members 12 | 13 | - David Kopec — [@davecom](https://github.com/davecom) 14 | 15 | ## Updates 16 | 17 | 18 | ### July 9 19 | 20 | I've gotten the open source JSTileMap library to work with Swift using Obj-C interop. I'm using it to read .tmx Tile maps created with the open source editor Tiled. I also discovered, along with the author of the JSTileMap library, a bug in Apple's PNG library on OS X that doesn't exist on iOS. It is related to the size of a particular PNG being miscalculated. For more details, you can read through this issue: 21 | https://github.com/slycrel/JSTileMap/issues/11 22 | 23 | I have started a basic level and have learned to use Tiled along with JSTileMap. 24 | 25 | ### July 23 26 | 27 | I implemented basic movement for the player within the environment and basic key mapping. The concept is that the player keeps moving until he hits a wall (barrier) of some sort. For now, you can try out a testing version with the keys "wasd" for up, left, down, right respectively. The player has to stay on a grid, so there are several waypoints along the way that I'm calling "decision points." A decision point is a place where the player could go in a different direction. If you press a key for a different direction before the player reaches a decision point, and that direction is available at the decision point (there's not a wall/barrier blocking it) then the player will change directions. The player can always reverse direction. A key function is findDecisionPoint() - I should work on optimizing it since enemy AIs will likely need to use it too. 28 | 29 | I'm looking for a good Cocoa control to use for user keyboard preferences (mapping which key goes to which direction). I looked at OpenEmu and they're just using text boxes - I've seen full keyboard layouts with drag and drop labels before in Mac games - I need to remember which ones and figure out what controls they're using or if they're doing it all manually. 30 | 31 | I need to create/find some better public domain art (sprite sheets really for Tiled) and start working on some enemies/goals/things to pick up for points. I have some basic ideas in my mind but I need to put them to paper. 32 | 33 | ### August 4 34 | 35 | I added some basic AI and hooks for more AI. I had to slightly refactor some of the code. The smart bit was putting the player movement code at the base of a class hiearchy that incorporates the AI characters (all of that decision point stuff is applicable to everything that moves in the game). 36 | 37 | I'm going to spend some time working on the art and future AI characters. 38 | 39 | ### August 18 40 | 41 | I haven't spent much time on Crump the last couple of weeks unfortunately beyond starting work on some graphics. 42 | 43 | ### September 3 44 | 45 | I started integrating my own (not great) artwork and implemented a couple basic AIs. One AI just randomly moves (EightBall) while the other tries to move in the direction of the closest player (Sun). In the process I found a couple serious movement bugs (going through a wall in a specific kind of corner, not going from one side of the screen to the other). 46 | 47 | Almost every new beta of Swift has required some minor code changes. I hope to really dig into the meat of the game during the next few weeks (developing several levels, support for multiple players (at least 2), and having some kind of objects to collect in each level, as well as cleaning up some graphics). 48 | 49 | ### September 18 50 | 51 | ### September 25 52 | -------------------------------------------------------------------------------- /projects/Pomodoro.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | ## Description 4 | 5 | Pomodoro is an IOS application designed to allow users to easily use the “Pomodoro” time management technique throughout their work day. The user of this application will be able to set a “Time Interval” which is the length of each chunk of work time throughout the day. The application will cycle between work and break time. The user will also set a specified amount of time that he or she wishes to make each break period. 6 | 7 | An example of this workflow would be a person selecting a work time interval of 24 minutes and a break time interval of 6 minutes. Throughout the entire day, the user will work for 24 minutes and then immediately transition to a break for 6 minutes and back to a work period for 24 minutes and so on. 8 | 9 | This application will include 3 main tabs - “Timer”, “Trends”, and “Settings”. Detailed below is a description of what each tab will display. 10 | 11 | Timer - This is the primary page of the application. The user will spend the most time in this view. In this view, the user will be able to see a visual display and timer of their current Pomodoro cycle and the amount of time left on the cycle. The time, day and date will also be displayed here. When using the application while working, a user will leave their phone turned on, on this screen. 12 | 13 | Trends - Trends will display the users overall work habits. Trends displayed will include things such as: 14 | 15 | - The total amount of time worked 16 | - Total amount of break time 17 | - Average time worked each day 18 | - The average break time each day 19 | - The most productive day of the week and month 20 | - Most productive time period of the day 21 | - How often the user is using the application 22 | - How often the user is meeting daily and weekly work goals 23 | 24 | Settings - Settings will present the user will a number of settings, customizations and other preferences that tailor the user experience to best fit each individual user. Settings options will include things such as: 25 | 26 | - Specified time interval 27 | - Daily Goal (min worked) 28 | - Weekly Goal (hours worked) 29 | - Sound on/off (The application will have the ability to play a short sound when an interval is completed) 30 | - Style (A white “Day” and black “Night” mode will be provided to best suit the user’s work environment) 31 | - Clock Style - Standard or Military 32 | - Add additional cycles to app (For example, a user might want to work for 24 minutes, take a break for 6 minutes and go for a walk every 2 hours for 15 minutes). 33 | 34 | ## Project Location 35 | 36 | https://github.com/BradHammond/PomodoroApplication 37 | 38 | ## Team Members 39 | 40 | Brad Hammond - @BradHammond, www.hammondbrad.com 41 | 42 | 43 | ## Updates 44 | 45 | 46 | ### July 10 47 | 48 | Project was setup, Github repository was created and empty project was pushed to Github. 49 | 50 | ### July 25 51 | 52 | During the past 2 weeks or so, I have continued studying Swift via reading Apples iBook and playing around with code in playgrounds. I have setup the basic layout of the Pomodoro Application (3 tab views) but have not yet added any code. In an effort to make this project more public, I have written a first blog post detailing the project on my website. This can be viewed at www.hammondbrad.com/blog 53 | 54 | ### August 10 55 | 56 | Not much has changed during the time between this weeks update and the last update. I have learned much more about Swift and have began to do some research on how to build the main timer functionality within my application. I am very new to programming and as is said very often with anything "the more that you learn, the more you realize how much you don't know". I feel that this quote is a good representation of the stage that I am at curently. I know a lot about Swift and think that it is a very neat language but am trying to grasp how to apply apply the principles learned in the Swift book and create an actual IOS application. 57 | 58 | ### August 25 59 | 60 | ### September 10 61 | 62 | ### September 2u 63 | -------------------------------------------------------------------------------- /projects/Bapit.md: -------------------------------------------------------------------------------- 1 | # Bapit 2 | 3 | ## Description 4 | 5 | Bapit is going to be a SpriteKit game written in Swift. It's a take on the classic game where you must tap a ball to keep it up in the air for as long as possible. 6 | 7 | ## Project Location 8 | 9 | https://github.com/hswolff/Bapit 10 | 11 | ## Team Members 12 | 13 | - Harry Wolff [@hswolff](https://twitter.com/hswolff) 14 | 15 | ## Updates 16 | 17 | (The dates below are the minimal dates suggested. Please feel free to update earlier & more often!) 18 | 19 | ### July 25 20 | 21 | The project has begun! 22 | 23 | I've created the initial game scaffold using Xcode's new Sprite Kit project layout. 24 | 25 | Basic gameplay is functional. You can tap only on the ball to cause it to move upwards in the scene. 26 | 27 | We're also calculating where inside the ball you touched and using that when calculating the impulse vector to apply to the ball. 28 | 29 | Also moving away from the .sks file and towards pure code implemenation of the game. 30 | 31 | ### August 10 32 | 33 | This creates my first enum and struct. 34 | 35 | The enum is for PhysicsBody category and collision bit mask, to allow 36 | me to handle contacts between two physics bodies correctly. 37 | 38 | The struct is to create a data type for storing the amount of taps 39 | that someone correctly tapped the ball, and someone missed it in case 40 | I'd want to use that information. 41 | 42 | Also moved to instantiating each property in the initializer function init(). 43 | 44 | Also sped up the game to make it be a little more challenging. 45 | 46 | Created the bottomBorder to know when the ball drops to the bottom. 47 | 48 | Created scoreLabel to show the current score of the game. 49 | 50 | Used the willSet observer to get notified when the TapCount struct is 51 | modified so we can then update the scoreLabel correctly. 52 | 53 | Add an extension to GameScene so we can become a contactDelegate 54 | and handle all contact instances. 55 | 56 | Abstract the setting up of the game kit view and initial scene 57 | so it's the same no matter how the game is created. 58 | 59 | Add ability to save the high score for that session of the game. 60 | 61 | Still using observing functions to make for easy binding and updating 62 | of the view. 63 | 64 | Created GameOverScene to present once the ball hits the bottom of the screen. 65 | 66 | Using SKTransition when presenting each scene for an added touch of life. 67 | 68 | Added a 'tap to start label' so that the game only starts once the player 69 | is ready. I'm controlling this behavior by changing the dynamic property 70 | of the ball's physicsBody. 71 | 72 | **Sidenote**: I'm really enjoying Swift's willSet/didSet property observer methods 73 | on properties. Really makes databinding really easy and lightweight to use. Big 74 | props to Apple for that. 75 | 76 | ### August 25 77 | 78 | Improve the mechanism by which we have a 'resting' state of the game. 79 | 80 | Previously we were changing whether the ball's physicsBody's dynamic 81 | property was true or not. This property controls whether it is effected 82 | by the physics simulation in the page. So, when it's false it doesn't 83 | move at all. 84 | 85 | However there was a performance hit when turning dynamic to true as 86 | it required some initial processing to begin emulating how the physics 87 | in the scene should behave. 88 | 89 | As a result you could sometimes tap the ball too soon prompting there 90 | to be a noticable lag in the game and make the overall game play not as 91 | smooth as it should be. 92 | 93 | Instead I'm taking the route of changing the physicsWorld.speed property 94 | from 0 to the desired value. This seems to add no performance hit 95 | and accomplishes the same thing we wanted to happen. 96 | 97 | Fixes for beta6. The interfacing with obj-c APIs have changed a little. 98 | 99 | Tweak animation when going from game scene to game over scene. 100 | 101 | Created MainMenuScene as the first thing that people see when they open the app. 102 | 103 | It has two buttons right now, one to play and one to go to settings (which 104 | doesn't exist yet). 105 | 106 | Updated the flow of the game to be a little more fluid. Tweaked the 107 | animations as well to make it feel more cohesive. 108 | 109 | ### September 10 110 | 111 | Sadly I haven't had a lot of time to work on Bapit in the past two weeks. The only work I've managed to do in this interim is to update my project to be compatible with beta 7. Today I tried it with the GM and it also worked without edit. 112 | 113 | The edits I had to do for beta7 were a little curious as they required adding `?` when accessing certain properties on an object. 114 | 115 | For example on a SKScene when showing a new scene, before I could do: 116 | 117 | ``` 118 | view.presentScene(scene, transition: transition) 119 | ``` 120 | 121 | Whereas in beta 7 (and GM) I had to modify it to: 122 | 123 | ``` 124 | view?.presentScene(scene, transition: transition) 125 | ``` 126 | 127 | Little curious about the why to this change. 128 | 129 | Aside from that it was an easy upgrade. 130 | 131 | ### September 25 132 | 133 | Sadly haven't had much time to work on Bapit these past two weeks. 134 | 135 | I have been planning out the next changes I need to add before I am ready to publish the game to the App Store. 136 | 137 | First: I need to add ads to the game to see if any passive income can be made. I was considering both iAd and AdMob. I read a couple of reviews regarding their performance and at the moment I'm leaning towards AdMob as my first ads provider. I did read that a good practice people have taken is to add a layer of abstraction on top of their ad providers that not only protects against changes in the SDK but also allows you to fall back to an alternative ad network if one ad network isn't able to fill the ad slot. 138 | 139 | The last thing to do is add some actual color, style, and design to the application. I think I'm going to go with a dodgeball theme, where the ball will resemble a dodgeball and the background will look like a schoolyard basketball court with field in the background. I think this will keep the game light and jovial. 140 | 141 | After those two updates I'm going to release a version 1 so that I don't get stuck in development hell. And then it's onwards to version 2! 142 | 143 | Had so much fun learning Swift and SpriteKit this summer. So glad you guys made this contest. Thank you! -------------------------------------------------------------------------------- /projects/SwiftThrift.md: -------------------------------------------------------------------------------- 1 | # SwiftThrift 2 | 3 | ## Description 4 | 5 | Implementation of Swift target language for the [Thrift](https://thrift.apache.org) message serialization library. This project consists of 2 parts: 6 | 7 | - a runtime for message serialization and RPC, written in Swift 8 | - a code generator for emitting Swift code from a Thrift IDL, written in C++ 9 | 10 | My intention is to get this merged into either Apache's Thrift project or Facebook's fork. 11 | 12 | ## Project Location 13 | 14 | 'swift' branch on a fork of the Apache Thrift project 15 | 16 | https://github.com/klazuka/thrift/tree/swift 17 | 18 | ## Team Members 19 | 20 | - Keith Lazuka - [@klazuka](https://github.com/klazuka) 21 | 22 | ## Updates 23 | 24 | ### July 13 25 | 26 | Began work on the runtime, with a focus on basic message serialization/deserialization. 27 | 28 | ### July 27 29 | 30 | The runtime is almost finished. You can serialize and deserialize all of the Thrift types, including collections and custom structs. The big remaining piece of functionality is to provide an RPC client transport (RPC server support is off-the-table for the initial release). 31 | 32 | But I have also run into a few problems. 33 | 34 | Swift's compiler-enforced initialization rules are great for type-safety, but it can also be too strict. For instance, when building up your object in a loop, the compiler errorneously reports that some of the properties were not initialized by the end of the init() function. I have filed a bug with Apple http://openradar.appspot.com/radar?id=5866914186264576. 35 | 36 | This is a problem for my project because the input data for deserialization is unordered. So I need to loop through the data, filling-out properties as I go. In nearly all cases, the object will be completely initialized when the loop terminates, but the Swift compiler disagrees. 37 | 38 | The other big problem which I have not yet solved is related to error-handling. Swift does not have exceptions, and yet Thrift itself uses exceptions heavily, both as values for failed RPC calls as well as for internal errors (e.g. buffer underflow). So far I'm just relying on assert() and fatalError(), but eventually I will need to make it work such that it does not crash the host application when an (inevitable) error is encountered. 39 | 40 | In the RPC return value case, the solution should be pretty straightforward: define an enum with a success case and a case for each possible exception that the server may throw. 41 | 42 | But I'm still undecided on how to handle internal errors such as buffer underflow or any other violation of the Thrift protocol. 43 | 44 | Here's one thing that I learned: obtaining the IEEE-754 binary representation of a Double is actually just as easy to do in Swift as it is in c/c++/objc: all you need to do is call reinterpretCast(), binding the return value to a let/var of type UInt64. Given Swift's type-safety, I was worried that it was going to be very difficult to do. I'm glad that there's an escape hatch. 45 | 46 | 47 | ### August 9 48 | 49 | Apple responded and closed my radar regarding false-positive compiler errors related to property assignment in Swift initializers. I updated [my post on OpenRadar](http://openradar.appspot.com/radar?id=5866914186264576) to include Apple's response. The long and the short of it is that the Swift compiler conservatively rejects some valid programs when it cannot accurately determine whether a variable/property has been assigned at the end of the initializer. The workaround for my project is either going to be assigning a dummy value for each Thrift property when the property is defined or use a force-unwrapped optional. I still haven't decided. 50 | 51 | I have spent quite a bit of time working on how to handle errors. The Thrift protocol heavily depends on the use of exceptions for both RPC application errors and Thrift runtime errors (such as buffer underflow and unexpected end-of-stream). But Swift does not allow you to throw or catch exceptions. Your choices are either crash the program (an acceptable choice for an app that you're writing, but not for a library) or return an error code whenever an error can be encountered. 52 | 53 | I have chosen to take the latter route. But since an error can occur deep in the Thrift runtime, threading the error up the callstack results in a lot of boilerplate code to unpack, process and re-pack values. My solution is to introduce an enum that represents either an NSError or a generic value, and then use functional operators (like `fmap` and `bind`) to sequence/compose operations that may return an error. So far I've been experimenting with the error-handling in a separate project, but Landon Fuller has written-up a pretty good example that illustrates how something like this could be done in Swift for a [network client application](http://landonf.org/share/060714_149C1AF7_result-chaining.swift) 54 | 55 | Unfortunately once you start to use Swift's enums in more powerful ways, you quickly run into compiler bugs. One big limitation is that enum's don't support generic types for their associated values, as described [here](http://owensd.io/2014/08/06/fixed-enum-layout.html). That bug at least results in an assertion failure in the Swift compiler. But other bugs are more subtle: I wasted a couple hours this morning trying to figure out why the Swift compiler was maxing out my CPU in an infinite loop. Commenting and un-commenting large blocks of code eventually lead me to determine that the culprit was an infinite loop in the compiler when emitting the code for a switch statement case that includes a nested pattern with a typecast. I filed the bug with Apple and [cross-posted to OpenRadar](http://openradar.appspot.com/radar?id=4978947682992128). 56 | 57 | There's still a lot left to do in my project. I never anticipated that the Swift language and compiler would be under such heavy development this summer. Just keeping pace with the language changes and working around compiler instability/bugs has been a challenge. 58 | 59 | ### August 24 60 | 61 | Last week I migrated my project over into a proper [fork](https://github.com/klazuka/thrift) of the Apache Thrift codebase on Github. This will make it easier to begin to integrate with the existing test suite and to begin work on the code generator. So far all I've done is copy over my existing Swift library code into a new 'swift' sub-directory in the 'lib' folder. 62 | 63 | Error-handling continues to be an open question for my project. After spending a bunch of time experimenting with functional techniques for "chaining" error-ful computations together, I've switched to exploring a different technique from the world of functional programming: separating out the error-ful code from the pure code. The [original implementation](https://github.com/apache/thrift/blob/6d1a83aa485ed9c3644d3200555700070547bf90/lib/hs/src/Thrift/Protocol.hs) of the Thrift library for Haskell was written in the former style (using the IO monad's "exception" support) where the Thrift 'protocol' layer sat on top of the Thrift 'transport' layer. The transport layer is what reads and writes bytes, and depending on what it's hooked up to (a socket, a file descriptor, a memory buffer) it may generate errors when you read or write. Recently the Haskell Thrift library has been [re-written](https://github.com/apache/thrift/blob/af5d64adb7c2e0ac130e9f9499375429f1408eff/lib/hs/src/Thrift/Protocol.hs) in a style that separates the building/parsing of the encoded Thrift values from the actual reading/writing of bytes from/to the underlying transport. So now there is a 'driver' which runs the transport layer, handles any errors, and provides the bytestream to the protocol layer. This makes the protocol layer much simpler by reducing the number of code paths for handling errors. 64 | 65 | I like the latter approach for Swift because it depends less-heavily on custom operators (such as monadic bind and applicative apply). Those functional operators are more easily expressed in Haskell where you have syntactic sugar for monadic bind and function evaluation is lazy and curried by default. So I'm exploring this directly currently in a [branch](https://github.com/klazuka/thrift/blob/swift-error-handling/lib/swift/src/TProtocol.swift) and a [toy parser project](https://github.com/klazuka/Parsec). 66 | 67 | In other news, Xcode6-beta6 closes the book on recursive enum types: it's now a compile-time error (previously it was an "unimplemented" assertion failure in the Swift compiler, leaving hope that they would implement it before going 1.0). So it looks we are stuck with boxing the recursive type. Oh well. 68 | 69 | I'm going on vacation during the first 2 weeks of September, so this will be the last update until sometime after mid-September. 70 | 71 | ### September 15 72 | 73 | I made little-to-no progress since the last update while I was on vacation. One thing I learned: there is a new project out there called [swift-cc](https://github.com/swift-cc/tools) to compile Swift code to object files that can be used in an Android app via the NDK/JINI. Looks rough, but promising. 74 | 75 | ### September 25 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Summer of Swift 2 | =============== 3 | 4 | _An Ephemeral Contest to Learn Swift by Doing_ ![analytics](https://ga-beacon.appspot.com/UA-50247013-2/summer-of-swift/README?pixel) 5 | 6 | ### What is it? 7 | 8 | The Summer of Swift came from conversations at SF’s [Swift Language User Group](http://www.meetup.com/swift-language). The idea is that many developers learn by practice, and especially by building big apps. In essence, the Summer is just trying to provide objectives and a framework to motivate developers to build a Swift app this Summer. 9 | 10 | ### How does it work? 11 | 12 | Participants in the Summer work on a project alone or in teams. **To enter, submit a pull request to this repo by July 15th**. Your PR should add a description of your project to the `projects/` folder, following the template in [`projects/TEMPLATE.md`](projects/TEMPLATE.md); it should also add an entry to the “[Big Board](#the-big-board)” section in this README. 13 | 14 | **_The only rule of the Summer of Swift is that you must edit your project file at least once every 2 weeks with an update on your progress & what you have learned so far. Projects who fail to do so will be crossed off from the “Big Board”._** 15 | 16 | If your update falls around one of the meetings of the [SLUG](http://www.meetup.com/swift-language) or any other similar meetup, we encourage you to give your update in person. At the SLUG, we’ll give every participating project a 5-minute lightning talk at every meeting to demo your progress & share what you’ve learned. If you cannot present in person, you can share your progress via a blog, github, twitter, youtube, etc. 17 | 18 | **The contest will run until September 30th.** 19 | We will conclude with a 2-hour meetup in San Francisco entirely devoted to the participants that toughed it out through the Summer. We expect to be able to fly in the people behind at least one (if not more) of the best projects outside San Francisco. Everybody will show off their apps and summarize all that they’ve learned about Swift over the Summer. The event will be recorded and shared on YouTube. 20 | 21 | ### Do I have to be in San Francisco to enter? 22 | 23 | No, you can compete from anywhere as long as you send updates to this repo regularly. 24 | 25 | ### What can I work on? 26 | 27 | Anything you want that helps you deepen your understanding of Swift: apps, games, libraries, tooling, documentation — anything is fair! 28 | 29 | ### That bi-monthly update requirement sounds rough! 30 | 31 | The bi-monthly update requirement is just there to encourage people to stay engaged and stick with their Swift project over a meaningful period of time. We understand that people have work, vacation, family and other things that may not let them adhere to an agressive learning schedule! Any of the following would be a good update 32 | - Github push to your repo 33 | - Blogpost about something you have learned so far 34 | - Video or tech talk you’ve given about your app 35 | 36 | We’ll accept any other signs of life from participants :) 37 | 38 | ### Are there any prizes? 39 | 40 | If you’re interested in offering prizes, motivators or help (books, online courses, etc.) to the contestants in the Summer of Swift, please email arwa@realm.io. Above all the Summer is about learning, so prizes may not be a good fit, but we do understand that sometimes motivators help ;) At the very least, you’ll get bragging rights and an eternity of posterity by being one of the few names not crossed off [The Big Board](#the-big-board). 41 | 42 | ### Sounds great! How do I enter? 43 | 44 | Send a pull request to this repo. Your PR must add a file with your project name to the `projects/` folder, following the template in [`projects/TEMPLATE.md`](projects/TEMPLATE.md) + adding an entry to the “[Big Board](#the-big-board)” section below. We ask that all projects enter the contest by July 15th at the latest. 45 | 46 | We do want to share a few aggregate updates about other Summer projects, as well as any announcements about prizes, local groups or hacknights by email (using the address in your initial git commit). You can let us know in the PR if you’d rather not receive any updates. 47 | 48 | ### I don’t have a project / can I join a project? 49 | 50 | Yes, you can submit PRs requesting to add yourself to an existing project. We’ll ask the original submitter(s) to :+1: it before merging it in. 51 | 52 | ### Can we meet somewhere to work on a project together? 53 | 54 | Absolutely. Here are the cities that host hacknights for the Summer 55 | - **San Francisco**, the [SLUG](http://www.meetup.com/swift-language/) will organize hacknights devoted to working on Summer projects. Just join the group to be notified of these events. 56 | - **Ottawa**, Come out to the [SLUGGO](http://www.sluggo.org/) Hacknights! We’re planning to meet every second Tuesday at 7pm at the Bridgehead at Richmond and Golden. (Depending on the turnout we may revisit the venue.) We thought we’d hold the first one next week – also conveniently July 15th. Keep coming every two weeks and you’ll be sure to keep posting updates on your project. Email svatek@gmail.com for details. 57 | - **Uppsala**, the 7th of August at 18:00 a hack night will be held somewhere in the city. Email johannesl@46elks.com for details. 58 | - **_Your city here?_** If you want to host similar hacknights somewhere else, email tim@realm.io or send a PR so we can add you to this page. 59 | 60 | ### I have another question — who can I contact? 61 | 62 | Reach out to Arwa \ and Tim \ 63 | 64 | # The Big Board 65 | 66 | This is the list of all the projects that have been entered. Names that are crossed off missed at least one bi-monthly update. 67 | 68 | - [Jazzy](projects/jazzy.md) by [@jpsim](https://github.com/jpsim) & [@timanglade](https://github.com/timanglade) 69 | - [Foursquift](projects/foursquift.md) by [@rodericj](https://github.com/rodericj) & [@krishnan-srinivasan](http://github.com/krishnan-srinivasan) 70 | - [Nudges](projects/nudges.md) by [@birarda](https://github.com/birarda) & [@problem](https://github.com/problem) 71 | - [BlueCap](projects/bluecap.md) by [@troystribling](https://github.com/troystribling) 72 | - [Crump](projects/crump.md) by [@davecom](https://github.com/davecom) 73 | - [Pinwheel](projects/pinwheel.md) by [@kreeger](https://github.com/kreeger) 74 | - [StarBridge](projects/starbridge.md) by [@stevethomp](https://github.com/stevethomp) 75 | - [Pythonic.swift](projects/Pythonic.swift.md) by [@practicalswift](https://github.com/practicalswift) 76 | - [Boris The Blade](projects/boris-the-blade.md) by [@neonichu](https://github.com/neonichu) 77 | - [Foggy](projects/foggy.md) by [@jsvatek](https://github.com/jsvatek) 78 | - [GatineauVélo](projects/GatineauVélo.md) by [@philippec](https://github.com/philippec) 79 | - [Pressure](projects/pressure.md) by [@ricburton](https://github.com/ricburton) & [@samskiter](https://github.com/samskiter) 80 | - [Krate - Create and Destroy](projects/krate.md) by [@stephenhaney](https://github.com/stephenhaney) 81 | - [ElksInbox](projects/ElksInbox.md) by [@johannesl](https://github.com/johannesl) 82 | - [HausClock](projects/HausClock.md) by [@nottombrown](https://github.com/nottombrown) 83 | - [Lo1Reader](projects/Lo1Reader.md) by [@ebierman](https://github.com/ebierman) 84 | - [SwifterTracker](projects/SwifterTracker.md) by [@xke](https://github.com/xke) 85 | - [The Oakland Post](projects/The%20Oakland%20Post.md) by [@aclissold](https://github.com/aclissold) 86 | - [SwiftMesh](projects/swiftmesh.md) by [@porumbes](https://github.com/porumbes) 87 | - [Card Deck](projects/card-deck.md) by [@zshannon](https://github.com/zshannon) 88 | - [The News (iPad)](projects/thenews-ipad.md) by [@tosinaf](https://github.com/tosinaf) 89 | - [Bapit](projects/Bapit.md) by [@hswolff](https://github.com/hswolff) 90 | - [Super To-Do](projects/super-to-do.md) by [@benghamine](https://github.com/dunphyben) 91 | - [Pomodoro](projects/Pomodoro.md) by [@BradHammond](https://github.com/BradHammond) 92 | - [Give and Take](/projects/GiveAndTake.md) by [@roop](https://github.com/roop) 93 | - [HockeyTweet](https://github.com/mthistle/HockeyTweetSwift) by [@mthistle](https://github.com/mthistle) 94 | - [The Yucatan Trail](projects/yucatan.md) by [@pshc](https://github.com/pshc) 95 | - [SwiftPack](projects/SwiftPack.md) by [@bdennyw](https://github.com/briandw) 96 | - [VDOTRunner](projects/VDOTRunner.md) by [@superdupertango](https://github.com/SuperTango) 97 | - [SwiftThrift](projects/SwiftThrift.md) by [@klazuka](https://github.com/klazuka) 98 | - [MotionAlarm](projects/motionAlarm.md) by [@yoshyosh](https://github.com/yoshyosh) & [@benmorrow](https://github.com/benmorrow) 99 | - [Analog Alarm](projects/analogAlarm.md) by [@davidkobilnyk](https://github.com/davidkobilnyk) 100 | - [HanekeSwift](projects/HanekeSwift.md) by [@hpique](https://github.com/hpique), [@lascorbe](https://github.com/lascorbe), [@joanromano](https://github.com/joanromano) & [@oriolblanc](https://github.com/oriolblanc) 101 | - [100DaysOfSwift](https://github.com/khuong291/100DaysOfSwift) by [@khuong291](https://github.com/khuong291) 102 | -------------------------------------------------------------------------------- /projects/The Oakland Post.md: -------------------------------------------------------------------------------- 1 | # The Oakland Post 2 | 3 | ## Description 4 | 5 | The mobile companion to [The Oakland Post](http://www.oaklandpostonline.com)! 6 | 7 | Contributions are more than welcome! :grin::thumbsup: 8 | 9 | ## Project Location 10 | 11 | https://github.com/aclissold/The-Oakland-Post 12 | 13 | ## Team Members 14 | 15 | - [@aclissold](https://github.com/aclissold) ([andrewclissold.appspot.com](http://andrewclissold.appspot.com)) 16 | 17 | ## Updates 18 | 19 | ### July 10 20 | 21 | Open-sourced the project and added screenshots! 22 | 23 | ### July 25 24 | 25 | A grand total of 26 | [41 commits](https://github.com/aclissold/The-Oakland-Post/commits/3bddf0ff25c6d1f3d8ba01e8439f4088960fb103) and 27 | [19 closed issues](https://github.com/aclissold/The-Oakland-Post/issues?q=closed%3A%3C2014-07-25) 28 | since the 10th. 29 | 30 | The majority of what I've been working on these past couple weeks has been this 31 | project, but three interesting micro-ideas arose from getting to play with Swift 32 | in this project: 33 | 34 | #### BugFixTableViewController 35 | 36 | [BugFixTableViewController](https://github.com/aclissold/BugFixTableViewController) 37 | is a tiny subclass of `UITableViewController` that fixes a small but very 38 | annoying bug that's been around since at least iOS 7 (meaning it's too late for 39 | it to be fixed in the SDKs). Just swap out your UITableViewControllers with 40 | BugFixTableViewControllers and you're good to go! 41 | 42 | #### GCD.swift 43 | 44 | [GCD.swift](https://github.com/aclissold/The-Oakland-Post/blob/365c491/The%20Oakland%20Post/GCD.swift) 45 | is a super thin wrapper around some dispatch_async functions. I *love* Swift's 46 | last-parameter closure syntax—it makes this possible: 47 | 48 | ``` swift 49 | onMain { 50 | // perform some UI task on the main queue 51 | } 52 | ``` 53 | 54 | #### maybe.swift 55 | 56 | I wondered if you could extend the builtin `Bool` to consist of not only 57 | `Bool.true` and `Bool.false` but also a `Bool.maybe`. So I came up with a way to 58 | do that in a Playground and stuck it in a `.swift` file. Here's how it looked: 59 | 60 | ``` swift 61 | import Darwin 62 | 63 | extension Bool { 64 | static var maybe: Bool { 65 | return arc4random() < (UInt32.max / 2) 66 | } 67 | } 68 | ``` 69 | 70 | I also included a `var maybe` with a computed getter returning `Bool.maybe`, 71 | since it's a value type and needs to return a new value each time it's 72 | accessed. 73 | 74 | However! Xcode 6 Beta 4 came along and made `true` and `false` literals in 75 | the grammar, nerfing the entire idea of a "maybe" living right alongside true 76 | and false. It was fun while it lasted! Plus, when there's three values it's technically 77 | not Boolean anymore :stuck_out_tongue: 78 | 79 | #### The Oakland Post 80 | 81 | As for my actual Summer of Swift project, I made a lot of great progress on it: 82 | 83 | * Implemented the core functionality of each of the main components 84 | * A **Home** view for the main newsfeed 85 | * **Sections** for newsfeeds of various categories 86 | * **Photos**, a dynamically arranged collection of images 87 | * **Blogs**, another newsfeed for an important category on the website 88 | * Decided on Avenir Next as the theme sans serif font and Palatino as the serif 89 | * Figured out how to load a fullscreen, high-res image when one of the Photos is tapped 90 | * Created a TopScrollable protocol for VCs that should scroll to the top when 91 | their tab bar item is tapped 92 | * Made a lot of UI improvements throughout 93 | 94 | There are just two main issues I ran into. 95 | 96 | 1. `dismissModalViewControllerAnimated` was working just fine, but when Swift 97 | became unable to use deprecated APIs, I switched that method call to 98 | `dismissViewControllerAnimated` instead... but this keeps giving me an 99 | `EXC_BAD_ACCESS` for some reason and I can't for the life of me figure out why. 100 | I enabled zombie objects, and it looks like one of the autolayout objects (an 101 | `NSLayoutGuide`) is being accessed after its container view is dismissed and 102 | deallocated... but I'm really not sure. I couldn't find any solutions online so 103 | filed it as a bug, since I would expect swapping methods like that to just work. 104 | 105 | 2. I'm displaying post content in a UIWebView, and using a couple lines of 106 | JavaScript to change the font and hide a header. However, this doesn't get 107 | executed until the content is fully loaded and visible, so I'm starting the web 108 | view out invisible and showing it after executing the JavaScript. Unfortunately, 109 | `stringByEvaluatingJavaScriptFromString(_:)` seems to be asynchronous, so I had 110 | to fudge a delay before showing the web view. If anybody knows of a better 111 | solution to this, please let me know! I found that the analogous method in 112 | `WKWebView` lets you pass a callback block (exactly what I want), but I'm targeting iOS 7+. 113 | 114 | ### August 10 115 | 116 | I'm headed off to Europe tomorrow so I'm submitting this early but counting it 117 | as an August 10th update! 118 | 119 | There are 120 | [25 new commits](https://github.com/aclissold/The-Oakland-Post/commits/5cba8530c00c4d9023634a834abd17c069949e8c) and 121 | [5 closed issues](https://github.com/aclissold/The-Oakland-Post/issues?q=closed%3A2014-07-25..2014-08-05) 122 | since last time. 123 | 124 | The vast majority of this work went towards whipping the Photos view into shape: 125 | 126 | ![Screenshot 2](https://raw.githubusercontent.com/aclissold/The-Oakland-Post/5cba8530c00c4d9023634a834abd17c069949e8c/The%20Oakland%20Post/Screenshots/Screenshot%202.png) 127 | 128 | You can now tap any image in the collection view and a full-screen version will 129 | fade in. A progress circle is displayed as 130 | [XPaths](http://en.wikipedia.org/wiki/XPath) and the 131 | [Open Graph protocol](http://ogp.me/) are used find to download a 132 | high-res version of the image from the server, which is then seamlessly swapped 133 | out with the lower-res version, even when you navigate back to the collection 134 | view. The 135 | [`EnlargedPhoto`](https://github.com/aclissold/The-Oakland-Post/blob/5cba8530c00c4d9023634a834abd17c069949e8c/The%20Oakland%20Post/EnlargedPhoto.swift) 136 | can be dismissed with a swipe or single tap, and zoomed with a pinch or double 137 | tap. And each image now provides a link to view the associated news post, which 138 | gets presented modally. 139 | 140 | ### August 25 141 | 142 | Although I've been in Europe between these two updates (just 143 | [2 closed issues](https://github.com/aclissold/The-Oakland-Post/issues?q=closed%3A2014-08-05..2014-08-25)), 144 | I did manage to make 145 | [23 commits](https://github.com/aclissold/The-Oakland-Post/commits/1a2e3f07ced2cabbde01f6d24ec4fe410d6e8c4a) 146 | in the past couple days. I fixed quite a few crashes, created 147 | [p.swift](https://github.com/aclissold/The-Oakland-Post/blob/9d26421d5b8553a19bc5916305a10f874b6ba488/The%20Oakland%20Post/p.swift) 148 | as an alias for `println()`, and created new Login and Sign Up views. 149 | 150 | But perhaps most importantly, I decided on [Parse](https://parse.com/) as a way 151 | to persist favorited Posts. I'd never heard of it before this week, but its 152 | ease-of-use is blowing my mind: 153 | 154 | ``` swift 155 | let username = usernameTextField.text 156 | let password = passwordTextField.text 157 | PFUser.logInWithUsernameInBackground(username, password: password) { 158 | // do stuff with the PFUser or NSError arguments to this callback closure 159 | } 160 | ``` 161 | 162 | is how simple it is to log in a user on the server! And to think I considered 163 | writing my own server and networking code. That would have been overkill for 164 | the scope of this project, and Parse looks like it'll do exactly what I need it 165 | to. 166 | 167 | Other than during the [MHacks](http://mhacks.org/) hackathon September 5th-7th, 168 | I'm expecting to lay down the law on this project these next two weeks, so stay 169 | tuned! 170 | 171 | ### September 10 172 | 173 | Two amazing things happened this weekend. 174 | 175 | I had a blast at MHacks, coding for 36 hours straight to create 176 | [TypeOneTwo](https://github.com/bpowell/mhacks) with 177 | [@bpowell](https://github.com/bpowell) and 178 | [@swiggins83](https://github.com/swiggins83). There were 1,000 hackers and over 179 | 300 teams… **and we made it into the top ten!** Wow! 180 | And fascinatingly, I couldn't find any other iOS hackers there using Swift. 181 | 182 | At some point during that weekend (all sense of time was a blur), I submitted 183 | this app to [Hacker News](https://news.ycombinator.com/item?id=8279293). There 184 | really aren't many examples of large Swift projects out there, and mine passed 185 | 2,000 lines of Swift this period. **It made it to the front page!** I couldn't 186 | believe it! At nearly 100 stars and over 2000 page hits, I'm very proud of what 187 | I've done. 188 | 189 | Sometimes I stop and think about how much I've learned since 190 | [a year and a half ago](https://github.com/aclissold/Python/tree/696a1485dfab39ebdc05ef5ad0abc8c1392bdcdd). 191 | I'm a completely different person. 192 | 193 | And as for the app, I finished the login system and started implementing starred 194 | posts—two very big features—and knocked out 195 | [2 issues](https://github.com/aclissold/The-Oakland-Post/issues?q=closed%3A2014-08-25..2014-09-10) 196 | and [21 commits](https://github.com/aclissold/The-Oakland-Post/commits/09e2e0dfb40863cc7a8f0ad739e5f0f4c896602d) 197 | in the process. I also had a lot of fun learning how to use 198 | [Sketch](http://bohemiancoding.com/sketch/) to design some 199 | [icons](https://raw.githubusercontent.com/aclissold/The-Oakland-Post/09e2e0dfb40863cc7a8f0ad739e5f0f4c896602d/The%20Oakland%20Post/Screenshots/Screenshot%201.png). 200 | It's a great feeling to finally be nearing a release to the App 201 | Store and be able to think about the app from such a high level. 202 | 203 | ### September 25 204 | -------------------------------------------------------------------------------- /projects/HanekeSwift.md: -------------------------------------------------------------------------------- 1 | # Haneke 2 | 3 | ## Description 4 | 5 | Haneke is a lightweight zero-config ~~image~~ generic cache for iOS. This a ~~port~~ complete redesign from Objective-C to Swift. 6 | 7 | ## Project Location 8 | 9 | 10 | 11 | ## Team Members 12 | 13 | - Hermes Pique - Twitter: [@hpique][2] / GitHub: [@hpique][3] 14 | - Luis Ascorbe - Twitter: [@lascorbe][3] / GitHub: [@lascorbe][4] 15 | - Joan Romano - Twitter: [@joanromano][5] / GitHub: [@joanromano][6] 16 | - Oriol Blanc - Twitter: [@oriolblanc][7] / GitHub: [@oriolblanc][8] 17 | 18 | ## Updates 19 | 20 | ### July 10 21 | 22 | First approach of the specifications on what the finished project must look like. 23 | 24 | ### August 10 25 | 26 | Getting a hang of the language and unit testing. 27 | 28 | The XCTest Swift API has improved greatly from Beta 1 to Beta 5. The XCTAssert macros were pratically unusable in Beta 1. 29 | 30 | A couple techniques that we found interesting: 31 | 32 | ##### Testing deinit 33 | 34 | func testDeinit() { 35 | weak var sut = Something() 36 | } 37 | 38 | ##### Verifying that a function gets called 39 | 40 | func testUIApplicationDidReceiveMemoryWarningNotification() { 41 | let expectation = expectationWithDescription("onMemoryWarning") 42 | 43 | class MemoryCacheMock : MemoryCache { 44 | 45 | var expectation : XCTestExpectation? 46 | 47 | override func onMemoryWarning() { 48 | super.onMemoryWarning() 49 | expectation!.fulfill() 50 | } 51 | } 52 | 53 | let sut = MemoryCacheMock("test") 54 | sut.expectation = expectation // XCode crashes if we use the original expectation directly 55 | 56 | NSNotificationCenter.defaultCenter().postNotificationName(UIApplicationDidReceiveMemoryWarningNotification, object: nil) 57 | 58 | waitForExpectationsWithTimeout(0, nil) 59 | } 60 | 61 | ### August 25 62 | 63 | We have an (almost) working LRU disk cache in Swift. Things we found interesting: 64 | 65 | ##### Using C libraries in framework projects 66 | 67 | Apparently this has been negledted up to Beta 5. We want to use CommonCrypto to calculate a MD5 hash and we got it working by using module maps. However, this has two limitations: 68 | 69 | * Using the custom framework in another project fails at compile time with the error missing required module 'CommonCrypto'. This is because the CommonCrypto module does not appear to be included with the custom framework. A workaround is to set the Import Paths in the project that uses the framework. 70 | * The module map is not platform independent (it currently points to a specific platform, the iOS 8 Simulator). We don't know how to make the header path relative to the current platform. 71 | 72 | More info: http://stackoverflow.com/questions/25248598/importing-commoncrypto-in-a-swift-framework 73 | 74 | ##### Golden path/early return with if let 75 | 76 | Swift does not appear to be golden path/early return friendly, assuming you use `if let` as encouraged. For example: 77 | 78 | private func calculateSize() { 79 | let fileManager = NSFileManager.defaultManager() 80 | size = 0 81 | let cachePath = self.cachePath 82 | var error : NSError? 83 | if let contents = fileManager.contentsOfDirectoryAtPath(cachePath, error: &error) as? [String] { 84 | for pathComponent in contents { 85 | let path = cachePath.stringByAppendingPathComponent(pathComponent) 86 | if let attributes : NSDictionary = fileManager.attributesOfItemAtPath(path, error: &error) { 87 | size += attributes.fileSize() 88 | } else { 89 | NSLog("Failed to read file size of \(path) with error \(error!)"); 90 | } 91 | } 92 | } else { 93 | NSLog("Failed to list directory with error \(error!)"); 94 | } 95 | } 96 | 97 | ### September 10 98 | 99 | We now have a fully functional LRU data disk cache and fully functiona memory+disk image cache. Now to polish and add features. 100 | 101 | ##### How to name block parameters 102 | 103 | `*block` parameters didn't feel right in Swift. So instead of... 104 | 105 | public func fetchData(key : String, successBlock : (NSData) -> (), failureBlock : ((NSError?) -> ())? = nil) 106 | 107 | ...which is very ObjC-like. for starters, these are closures, not blocks. Currently we're doing... 108 | 109 | public func fetchData(key : String, success doSuccess : (NSData) -> (), failure doFailure : ((NSError?) -> ())? = nil) 110 | 111 | ...which is shorter for both the API user and us. This won't likely be the naming standard, but it beats using `block` in parameter names. 112 | 113 | ### September ~~25~~22 114 | 115 | Last update! HanekeSwift is now a fully functional generic cache for iOS written in Swift. Not a port, but a complete redesign of the original Haneke that leverages Swift features such as generics to offer new functionality. Of course, there's a lot more work than can and will be done but the core functionaly is finished. 116 | 117 | Here are some things that we learned in the last few days: 118 | 119 | ####Type inference quirks of closures as parameters 120 | 121 | Swift can infer the type of closures when used as parameters. As shown in the official Swift [documentation](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html#//apple_ref/doc/uid/TP40014097-CH11-XID_152), this means that we don't need to write code like this: 122 | 123 | ```Swift 124 | let reversed = sorted(names) { (s1: String, s2: String) -> Bool in 125 | return s1 > s2 126 | } 127 | ``` 128 | 129 | Instead, we can simply write: 130 | 131 | ```Swift 132 | let reversed = sorted(names) { s1, s2 in 133 | return s1 > s2 134 | } 135 | ``` 136 | 137 | Because single-expression closures can implicitly return the value of the expression, the code above can be shortened to: 138 | 139 | ```Swift 140 | let reversed = sorted(names) { s1, s2 in 141 | s1 > s2 142 | } 143 | ``` 144 | 145 | Or even more succintly by using shorthand argument names: 146 | 147 | ```Swift 148 | let reversed = sorted(names) { $0 > $1 } 149 | ``` 150 | 151 | So far so good. However, the documentation leaves out some cases in which Swift fails to infer the closure type properly (as of Xcode 6.0). During the development of [Haneke](https://github.com/Haneke/HanekeSwift) we discovered the two below. You can follow along the code examples with [this playground](https://github.com/hpique/Articles/tree/master/Swift/Type%20inference%20quirks%20of%20closure%20parameters/Type%20inference%20quirks%20of%20closure%20parameters.playground). 152 | 153 | ##### Quirk 1: Single-expression closures with unused return value 154 | 155 | The first involves single-expression closures. Say we want to set the modification date of a file in background, without much care for errors. Intuitively, we would write something like this: 156 | 157 | ```Swift 158 | dispatch_async(someBackgroundQueue) { 159 | NSFileManager.defaultManager().setAttributes([NSFileModificationDate : someDate], ofItemAtPath: path, error: nil) 160 | } 161 | ``` 162 | 163 | Unfortunately the above code fails to compile with error `Cannot convert the expression's type '(dispatch_queue_t!, () -> () -> $T5)' to type 'Bool'`. 164 | 165 | The reason is that `NSFileManager.setAttributes` returns a `Bool`, and because the closure has a single-expression, the Swift compiler mistakenly infers that its return type is `Bool`. 166 | 167 | The workaround? We guide the Swift compiler by ignoring the result value with an underscore: 168 | 169 | ```Swift 170 | dispatch_async(someBackgroundQueue) { 171 | let _ = NSFileManager.defaultManager().setAttributes([NSFileModificationDate : someDate], ofItemAtPath: path, error: nil) 172 | } 173 | ``` 174 | 175 | ##### Quirk 2: Unused parameters in closures 176 | 177 | Another quirk involves unused parameters in closures. Consider a function that fetches some data and can succeed or fail. 178 | 179 | ```Swift 180 | func fetchDataWithSuccess(success doSuccess : (NSData) -> (), failure doFailure : ((NSError?) -> ())) 181 | ``` 182 | 183 | When writing unit tests for this function we should test both the success case and the failure case. For the failure case, we should fail the test if the success closure gets called. The test could look something like this: 184 | 185 | ```Swift 186 | func testFailure() { 187 | // Simulate a failure condition 188 | 189 | let expectation = self.expectationWithDescription("fetch") 190 | fetchDataWithSuccess(success: { 191 | XCTFail("expected failure") 192 | expectation.fulfill() 193 | }, failure : { e in 194 | XCTAssertNotNil(e) 195 | expectation.fulfill() 196 | }) 197 | self.waitForExpectationsWithTimeout(1, handler: nil) 198 | } 199 | ``` 200 | 201 | Surprisingly this doesn't compile. The error message is not very helpful: `'NSData' is not a subtype of '()'`. 202 | 203 | The problem lies in the unused parameter of the success block. The Swift compiler assumes that the success closure does not have any parameters, and fails to match this with the expected type of the success closure. 204 | 205 | What to do? Again the amazing underscore comes to our rescue: 206 | 207 | ```Swift 208 | func testFailure() { 209 | // Simulate a failure condition 210 | 211 | let expectation = self.expectationWithDescription("fetch") 212 | fetchDataWithSuccess(success: {let _ in 213 | XCTFail("expected failure") 214 | expectation.fulfill() 215 | }, failure : { e in 216 | XCTAssertNotNil(e) 217 | expectation.fulfill() 218 | }) 219 | self.waitForExpectationsWithTimeout(1, handler: nil) 220 | } 221 | ``` 222 | 223 | Telling Swift that the success closure has a parameter, even if we ignore it, is enough help to let it infer the type correctly. 224 | 225 | 226 | [1]: https://twitter.com/hpique 227 | [2]: https://github.com/hpique 228 | [3]: https://twitter.com/lascorbe 229 | [4]: https://github.com/lascorbe 230 | [5]: https://twitter.com/joanromano 231 | [6]: https://github.com/joanromano 232 | [7]: https://twitter.com/oriolblanc 233 | [8]: https://github.com/oriolblanc 234 | -------------------------------------------------------------------------------- /projects/pinwheel.md: -------------------------------------------------------------------------------- 1 | # Pinwheel 2 | 3 | ## Description 4 | 5 | I've just started working on a fully-functional Pinboard client for iPhone and iPad. This project aims to include a Safari / System Extension that will allow sending URLs from other apps to your Pinboard account. 6 | 7 | I'm going lone-wolf on this one (the way I like it) and I aim to learn a great deal about Swift and the latest offerings provided by iOS 8. It'll include a full (and likely separate) API adapter for the Pinboard REST API as well (hopefully useable by others as a CocoaPod). 8 | 9 | ## Project Location 10 | 11 | It lives at https://github.com/kreeger/pinwheel. GitHub Pages site is forthcoming, once I get the project far enough along. 12 | 13 | ## Team Members 14 | 15 | - Ben Kreeger — @kreeger on [GitHub](https://github.com/kreeger), [Twitter](https://twitter.com/kreeger), ad nauseum 16 | 17 | ## Updates 18 | 19 | ### July 10 20 | 21 | In starting this project off, I discovered a bit of a snag when working with the Keychain API in Swift. Below is a blog post I wrote about it. 22 | 23 | --- 24 | 25 | So the Keychain is a nightmare and a half to work with in Swift right now. I'm trying to write a Keychain client using some code I've found on the Internet, but evidently I can't seem to get the hang of using these Foundation constants as keys in a Swift dictionary (to pass to `SecItemCopyMatching`). I've copied and pasted [the code from this post][mattpalmer], and the compiler gripes that there's no overload for `init` method for `NSDictionary` that accepts my supplied parameters. Evidently I'm [not the only one][so-me-too] with this problem, either. 26 | 27 | ``` swift 28 | var keychainQuery: NSMutableDictionary = NSMutableDictionary( 29 | objects: [kSecClassGenericPassword, service, accountName, kCFBooleanTrue, kSecMatchLimitOne], 30 | forKeys: [kSecClass, kSecAttrService, kSecAttrAccount, kSecReturnData, kSecMatchLimit]) 31 | ``` 32 | 33 | It seems to happen when I start mixing in my incoming `String` parameters into the dictionary's keys/values. What would be *awesome* is if I could use the dictionary syntax that Swift provides for us in order to build my Keychain query dictionary. That would require converting these Foundation constants into retained String values, right? Well, sadly that causes a nasty compiler error. 34 | 35 | ``` swift 36 | var secClass: String = kSecClass.takeRetainedValue() as String 37 | ``` 38 | 39 | Barf. 40 | 41 | ``` 42 | Bitcast requires both operands to be pointer or neither 43 | %152 = bitcast %objc_object* %151 to %PSs9AnyObject_, !dbg !206 44 | Bitcast requires both operands to be pointer or neither 45 | %153 = bitcast %PSs9AnyObject_ %152 to i8*, !dbg !206 46 | LLVM ERROR: Broken function found, compilation aborted! 47 | ``` 48 | 49 | I've filed a bug report for this on Apple's bug reporter. Here's to hoping this gets fixed in Beta 3 (which I'm assuming is out Tuesday). I know I'm [not the only person to run into *this* issue][other-issue], either. 50 | 51 | [mattpalmer]: http://matthewpalmer.net/blog/2014/06/21/example-ios-keychain-swift-save-query/ 52 | [so-me-too]: http://stackoverflow.com/questions/24453808 53 | [other-issue]: http://stackoverflow.com/questions/24145838 54 | 55 | --- 56 | 57 | I'm working around the Keychain altogether for now and I'm starting to get a login view controller whipped up in code using Auto Layout. Once I get that settled, it's on to more API calls to Pinboard! 58 | 59 | --- 60 | 61 | ### July 25 62 | 63 | Most of my efforts lately have focused around JSON parsing and exploring how Swift's enums work. Here's my blog post on the subject. 64 | 65 | --- 66 | 67 | In my recent work on [Pinwheel](https://github.com/kreeger/pinwheel) whenever I have the time (heh), I've gotten used to some of the more interesting behaviors and idioms of Swift. While I still seem to have [issues accessing the keychain](/swift-related-keychain-woes) in a sane manner, I finally experienced somewhat of a "eureka" moment when trying to parse a JSON response from the Pinboard API, but not after some frustration and face-palming. 68 | 69 | I stubled upon [SwiftyJSON][gh-repo] after looking at a [series of][blog1] [blog posts][blog2] by David Owens II (as I assume many Swift early explorers have), and cracked open [the main source file][swifty] and my brain proceeded to melt. *None of it made much sense to me*, and I quickly realized that it's because the `JSONValue` class was implemented as an `enum` type. I'm familiar with enum types in other languages, especially Objective-C, so when I saw all this other extra stuff sprinkled in (including *methods*? *calculated properties*? *switch statements*? *what*?), I couldn't tell if I was looking at a `class` or something else. 70 | 71 | Determined to figure this thing out (since obviously other people have as well), I turned to Apple's rather thorough [documentation on Swift enumerations][enum-doc], and after multiple read-throughs, I picked out a couple of sections that were extremely relevant to understanding the code at hand: 72 | 73 | - [Matching Enumeration Values with a Switch Statement][enum-doc1] 74 | - [Associated Values][enum-doc2] 75 | 76 | These two features combined make Swift `enums` somewhat of a force to be reckoned with. I'm still getting a handle on just what exactly these are fully capable of (hint: a lot), but with those concepts combined, a class like SwiftyJSON's `JSONValue` are possible, and here's how. 77 | 78 | #### Enum initialization 79 | 80 | You can create an initializer on your custom enum. Note that there isn't one provided for you by default, but when you do add one, you'll need to make sure that by the time you `return self` from the function that you've assigned one of the `enum` cases to `self`. This is how SwiftyJSON embraces this capability (reformatted for brevity; [see the full source][sj-init]), in two phases (the first utilizes the second). 81 | 82 | ``` swift 83 | init (_ data: NSData!) { 84 | if let value = data { 85 | var error: NSError? = nil 86 | if let jsonObject: AnyObject = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: &error) { 87 | self = JSONValue(jsonObject) 88 | } else { 89 | self = JSONValue.JInvalid(jsonError) 90 | } 91 | } else { 92 | self = JSONValue.JInvalid(dataError) 93 | } 94 | } 95 | ``` 96 | 97 | If de-serialization fails for whatever reason, there's a `JInvalid` case that serves as an error state for the enumeration, to ensure there's still a state assigned to `self` by the time the initializer finishes. If data de-serialization succeeds, then the resulting `NSDictionary` is passed to the *other* initializer, which is shown below. Note that this example is also truncated for brevity, so please [look at the full source][sj-init1] for a better picture. 98 | 99 | ``` swift 100 | init (_ rawObject: AnyObject) { 101 | switch rawObject { 102 | case let value as NSNumber: 103 | if String.fromCString(value.objCType) == "c" { 104 | self = .JBool(value.boolValue) 105 | return 106 | } 107 | self = .JNumber(value) 108 | case let value as NSString: 109 | self = .JString(value) 110 | case let value as NSNull: 111 | self = .JNull 112 | // So on and so forth, for arrays, dictionaries, etc. 113 | } 114 | ``` 115 | 116 | Each of these cases work as a type check, and if one succeeds, the "type case" (either `JBool`, `JString`, `JArray`, etc.) is assigned to self, and the actual typed data is assigned to the instance/case of the enum as an "associated value." 117 | 118 | #### Associated value handling 119 | 120 | Each of these "type cases" are defined at [the top of the class][sj-cases]. 121 | 122 | ``` swift 123 | case JNumber(NSNumber) 124 | case JString(String) 125 | case JBool(Bool) 126 | case JNull 127 | case JArray(Array) 128 | case JObject(Dictionary) 129 | case JInvalid(NSError) 130 | ``` 131 | 132 | Depending on the case chosen in the initializer, the instance of the enum gets handed the value of the specific type. Note that `JNumber` gets handed an `NSNumber`, because this more generic number class handles both `Int` and `Double` number types; those are pulled out of the enumeration below. Take a look at [the property accessor for the `integer` property][sj-property]: 133 | 134 | ``` swift 135 | var integer: Int? { 136 | switch self { 137 | case .JBool(let value): 138 | return Int(value) 139 | case .JNumber(let value): 140 | return value.integerValue 141 | case .JString(let value): 142 | return (value as NSString).integerValue 143 | default: 144 | return nil 145 | } 146 | } 147 | ``` 148 | 149 | This funky syntax is what initially threw me for a loop. `case .JBool(let value)`? What's the `let value` doing in *there*? [Apple's documentation on Associated Values][enum-doc2] explains this part. 150 | 151 | > ...The associated values can be extracted as part of the switch statement. You extract each associated value as a constant (with the let prefix) or a variable (with the var prefix) for use within the switch case’s body. 152 | 153 | The switch statement in Swift is defined in such a way that we can *check the associated value* by assigning to it in a syntax that *looks* as if you're "reverse assigning" the case, or something. 154 | 155 | #### Putting it all together 156 | 157 | So using the recursive initializer that assigns itself cases based on type, plus assigning associated values to each instance of the enum, provides a pretty powerful way to turn a big JSON object into a easily-useable "object-like" object. Here's how I'm using it in a part of [Pinwheel][pw-link]. 158 | 159 | ``` swift 160 | var parsed = [PinboardPost]() 161 | for post in result["posts"].array! { 162 | parsed.append(PinboardPost(responseDict: post)) 163 | } 164 | ``` 165 | 166 | It's pretty easy to turn my `result` instance, which is a `JSONValue`-wrapped object, into a powerful, traversable object. Then I can pluck out values relatively easily in my object initializer as well. 167 | 168 | ``` swift 169 | class PinboardPost { 170 | let title: String 171 | var extendedDescription: String? 172 | let hash: String 173 | let href: NSURL 174 | // ... 175 | 176 | init(responseDict: JSONValue) { 177 | self.title = responseDict["description"].string! 178 | self.extendedDescription = responseDict["extended"].string 179 | self.hash = responseDict["hash"].string! 180 | self.href = responseDict["href"].url! 181 | // ... 182 | } 183 | } 184 | ``` 185 | 186 | Big thanks go to [Ruoyu Fu][lingoer] and his [SwiftyJSON][gh-repo] library; it's been a tremendous help in learning and utilizing Swift! 187 | 188 | [blog1]: https://medium.com/swift-programming/b6f4f232e35e 189 | [blog2]: https://medium.com/swift-programming/swift-json-parsing-716ea9be1c5b 190 | [swifty]: https://github.com/lingoer/SwiftyJSON/blob/master/SwiftyJSON/SwiftyJSON.swift 191 | [gh-repo]: https://github.com/lingoer/SwiftyJSON 192 | [enum-doc]: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html 193 | [enum-doc1]: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html#//apple_ref/doc/uid/TP40014097-CH12-XID_186 194 | [enum-doc2]: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Enumerations.html#//apple_ref/doc/uid/TP40014097-CH12-XID_187 195 | [sj-init]: https://github.com/lingoer/SwiftyJSON/blob/85703f67fa39730dceae2a1c7813242ee5a8269c/SwiftyJSON/SwiftyJSON.swift#L142 196 | [sj-init1]: https://github.com/lingoer/SwiftyJSON/blob/85703f67fa39730dceae2a1c7813242ee5a8269c/SwiftyJSON/SwiftyJSON.swift#L156 197 | [sj-cases]: https://github.com/lingoer/SwiftyJSON/blob/85703f67fa39730dceae2a1c7813242ee5a8269c/SwiftyJSON/SwiftyJSON.swift#L29 198 | [sj-property]: https://github.com/lingoer/SwiftyJSON/blob/85703f67fa39730dceae2a1c7813242ee5a8269c/SwiftyJSON/SwiftyJSON.swift#L74 199 | [pw-link]: https://github.com/kreeger/pinwheel 200 | [lingoer]: https://github.com/lingoer 201 | 202 | --- 203 | 204 | Now it's back to work on more API components. Progress was slow this last week but I aim to pick things up again at a better pace next week. 205 | 206 | --- 207 | 208 | ### August 10 209 | 210 | In getting to crack Pinwheel open again, naturally everything's all kinds of broken again. Evidently the few changes I had to make include... 211 | 212 | - Swapping out some of my useages of `+=` with `.append()` instead 213 | - Adding `required init(code aDecoder: NSCoder) {}` initializers to my UIView(Controller) subclasses 214 | - Evaluating ` != nil` instead of just `` in a few places 215 | 216 | As far as the "state of the union as I see it," Swift is still incredibly frustrating to work with under Xcode (the latest beta being Xcode 6 Beta 5) due to the SourceKitService dying out constantly. Smart highlighting and code suggestions still just go *right* out the window. The way I see it? September's right around the corner. I really hope they can get these bugs ironed out before then, because I would like to start using Swift in a professional capacity instead of just on personal projects. Until the Xcode/SourceKit bugs are fixed, I can't see myself doing that. 217 | 218 | In either case, I had some Pinboard API authentication issues, and they were caused by some errant Swift code that tried to modify an incoming variable. It *used* to work, and I was pretty dubious then about whether it would continue to work as Apple refined the Swift compiler. Turns out I was right. 219 | 220 | For a positive spin on things, Xcode finally supports grepping for `// MARK` and `// TODO` so that they'll show up in the symbol navigator. I'm using them now in the code for my Pinboard API client (where I'm utilizing extensions to separate post retrieval vs other calls). 221 | 222 | ![Symbol Navigator](http://f.kree.gr/blog/2014/symbol-menu.png) 223 | 224 | In addition to these, I also get pretty nerdy about docstrings. I like to include them wherever possible. In previous betas, Xcode's built-in parsing was much like pulling teeth, but since Beta 5 came out, support for these is better than ever (and a tip of the hat to [NSHipster's post on the subject a couple of weeks ago](http://nshipster.com/swift-documentation/), which even sheds light on a rudimentary reStructuredText parser built into SourceKit). 225 | 226 | ```swift 227 | // MARK: User authentication 228 | extension PinboardClient { 229 | /** 230 | Trades a username and password for a login token, which is assigned to this adapter's 231 | credentials property. 232 | 233 | See https://pinboard.in/api#user_api_token 234 | 235 | :param: username The username to deliver to Pinboard's API. 236 | :param: password The password to deliver to Pinboard's API; is never stored. 237 | :param: completion A block to be called upon completion. 238 | */ 239 | func login(#username: String, password: String, completion: ((PinboardCredentials?, NSError?) -> Void)) { 240 | // ... 241 | } 242 | } 243 | ``` 244 | 245 | ![Parsed Comments](http://f.kree.gr/blog/2014/parsed-comments.png) 246 | 247 | Apart from these discoveries and minor frustrations, I'm still plugging away (slowly) at Pinwheel. Eventually a basic version will see the light of day! 248 | 249 | ### August 25 250 | 251 | Normally for just about every software project I've worked on in the last year and a half, I've used [Trello][]. For some reason, [Pinwheel][pinw] (my project for [Summer of Swift][sos]) hasn't been granted its own board yet! Shame on me. [I've rectified that][board]. In the days and weeks to come I'll continue to fill out that board with tons of cards and maybe a new list or two. In the meantime, I'm still mashing my fists against the keyboard in a fit of learning. 252 | 253 | I know Objective-C and the Cocoa Touch APIs pretty well at this point, but throwing Swift on top of it complicates things in a way I didn't forsee. Things don't just translate one-to-one from Objective-C. The two big things you've gotta worry about are, not coincidentally enough, two of the biggest features Swift brings to the table. 254 | 255 | 1. Optionals. 256 | - Type casting. 257 | 258 | They add a whole new level of *required comprehension* on top of the Cocoa (Touch) APIs. You have to work with — and sometimes *around* — APIs that return objects that may be nil. This flies right in the face of Objective-C's nil messaging paradigm that I know and (usually) love. You have to know and understand which methods accept and return some weird Swift equivalent of Objective-C's fast-and-loose types (`Unmanaged`, anyone?). 259 | 260 | On top of all that, the most annoying part of learning this stuff is *still* `SourceKitService` crashing every 5 seconds, killing my indentation/syntax highlighting/autocomplete. I keep bitching about this, but it *is* the worst part of it. I can't wait for it to be fixed. 261 | 262 | All those issues aside, I'm definitely feeling a bit rusty back in iOS land. I think a large part of my ineptitude in writing this app is due to being "out of the game" somewhat. I've not written any apps in nearly 7 months, which is a tragically long time. More than long enough to forget how in the hell to dynamically size `UICollectionViewCells` with varied `UILabels` inside of them. Tonight it took me nearly an hour to get it right. When I finally did, though, I felt pretty happy about it. 263 | 264 | ![Basic pins view](http://ben.kree.gr/content/images/2014/Aug/inspector.jpeg) 265 | 266 | But seriously, the Developer Tools team really needs to fix `SourceKitService`. 267 | 268 | [pinw]: https://github.com/kreeger/pinwheel 269 | [trello]: https://trello.com/kreeger/recommend 270 | [sos]: https://github.com/realm/summer-of-swift 271 | [board]: https://trello.com/b/Syn1z6ZC 272 | 273 | ### September 10 274 | 275 | While the last couple of weeks hasn't afforded me too much time to look into Pinwheel, I did get to crack it open in the last Xcode 6 beta and SourceKitService worked quite awesomely. It still has a tendency to barf when you operate inside of a somewhat complex `lazy var` block, and I can verify that's still the case in the final Xcode 6 GM release. It's still in a much better place, however, that I can really dig in and start to fill in the gaps on Pinwheel's functionality. I'm hoping at this point that I can get it out in the App Store by year's end, complete with Extensions for iOS 8, and maybe backwards compatibility support for iOS 7. 276 | 277 | ### September 25 278 | --------------------------------------------------------------------------------