🌐 Public

Swift

By Menno Wildeboer

Introduction

Apples new programming language. Awesomesauce! Will fill up in the future.

Menno Wildeboer — Product Developer: iOS, Rails, JS, Mobile, UX.

3 Swift Classes - Part 1

Creating a classTo create a new class use the class keyword followed by the class name and a pair of braces. Inside the braces we can declare the class properties. InitializersFrom Apple's Documentation: Initialization is the process of preparing an instance of a class, structure, or enumeration for use. This process involves setting an initial value for each stored property

4 Swift Classes - Part 2

InheritanceA class can inherit methods, properties, and other characteristics from another class. When one class inherits from another, the inheriting class is known as a subclass, and the class it inherits from is known as its superclass. Inheritance is a fundamental behavior that differentiates classes from other types in Swift. A simple example of inheritance: OverridingYou can override methods in

5 Swift Initializers

Swift, Apple's new programming language for iOS and OS X, makes several significant departures from Objective-C. What I found to be particularly interesting are the new semantics surrounding object lifecycles. Here are the key points: Formalizing convenience and designated initializers. Formalizing sequence of operations for initializers. Enforcing language-level, compile-time enforcement of these new semantics.I'm going to cover each of these

7 Swifting Around

I'm going to make a simple tableview with a custom cell type, use the new UIVisualEffectView from iOS 8 and then show off a bit of the power of Swift. It should take you about ~30 minutes to go through all the steps. Enjoy! if you are looking for a simpler tutorial for tableviews check out this one Create a

8 Higher Order Functions: Map, Filter, Reduce and more - Part 1

Introducing ClosuresOne of the great features of Swift is a clean new syntax for first class functions / closures that replaced the quite confusing block syntax. So hopefully we won't need something like fuckingblocksyntax for Swift. Closures are self-contained blocks of functionality that can be passed around and used in your code. In this article we'll focus on closures that

9 Object Subscripting in Swift - We ❤ Swift

What is Object SubscriptingSubscripts are shortcuts for accesing elements from a collection, sequence or list. They are used to set and retrieve values by index without needing separate methods for setting and retrieval. A type can have multiple subscripts and subscripts can have more than one dimension. To access elements via subscripts write one or more values between square brackets

10 Generics

Welcome to Swift Yeti! The blog that is all about the great ins and outs of Swift and Cocoa/CocoaTouch. We recieved a slurry of announcments this year at WWDC, one of the biggest being Swift. Swift Yeti will be covering different topics and frameworks from Apple, by doing what we do best - getting our hands dirty and implementing some

11 Extracting UIViews from UIViewControllers in Swift

On several recent iOS projects at Pivotal Labs, we've extracted the view property of a UIViewController and made it a subclass of UIView. The main advantage of this pattern is that it removes from the view controller all of the layout code that would normally clutter it up. We'd like to implement this pattern in Swift as well. In Objective-CHere's

12 Simple date arithmetic with Swift

Using date and time operations is a hard thing to do in most programming languages. On iOS and OS X it has always been especially laborious. Not only are there a number of different classes involved but the necessary methods also make it nearly impossible to write concise date and time calculations. The not-so-good old wayTake for example this piece

13 Custom Threading Operator in Swift

The Swift language supports custom operator functions, similar to operator overloading in C++. This kind of language feature has been known to enable overly "enthusiastic" developers to create a quagmire of unreadable code, which is why I was surprised to see it included in Swift. However, when used with careful consideration and restraint, defining new operators can yield elegant and

14 Regex in Swift

I've been playing around with Swift and one thing that struck me as odd/disappointing is the lack of regular expression literals. First off, the language is new and yes I've filed a radar (rdar://17257306 for Apple folks). Please dupe it if you care about this. What I mean by regular expression literals is this (Ruby code): The idea is that

15 Getting started with WKWebView using Swift in iOS 8

Back in "ViewController.swift" lets create an override for ´loadView´ and write the initialization for the WebView there. This function will look like this: override func loadView() { super.loadView() self.webView = WKWebView() self.view = self.webView } After calling super (which you should always do when overriding methods) we instantiate the webView itself self.webView = WKWebView() and then we tell the current

16 The Core Data stack in Swift

Whenever Apple releases a new version of Xcode one of the first things that I do is look at the default templates and see if there are any new or interesting things. This year, with the release of Swift, there are some pretty radical changes. Yet the Core Data stack initialization code is still the same. There is nothing wrong

20 Swift Sequences

We're incredibly excited about the new Swift programming language announced by Apple at this year's WWDC. As a way of experimenting, we've begun looking into what it would be like if we rewrote Liftoff, our command line Xcode project generation/configuration tool, in Swift. Liftoff supports a few options on the command line, so the first thing we're trying to do

22 Basic Setup

Basic Setup Important This is a preliminary document for an API or technology in development. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein for use on Apple-branded products. This information is subject to change, and software implemented according to this document should be tested with final operating system

23 Writing Swift Classes with Objective-C Behavior

Writing Swift Classes with Objective-C BehaviorInteroperability lets you define Swift classes that incorporate Objective-C behavior. You can subclass Objective-C classes, adopt Objective-C protocols, and take advantage of other Objective-C functionality when writing a Swift class. This means that you can create classes based on familiar, established behavior in Objective-C and enhance them with Swift's modern and powerful language features. Inheriting

25 Working with Cocoa Data Types

Working with Cocoa Data TypesAs part of its interoperability with Objective-C, Swift offers convenient and efficient ways of working with Cocoa data types. Swift automatically converts some Objective-C types to Swift types, and some Swift types to Objective-C types. There are also a number of data types in Swift and Objective-C that can be used interchangeably. Data types that are

Haris Hamdani

a daydreamer. he thinks that someday he'll visit north pole, who knows!

  • 0 Playlists
  • 0 Followers

matzyc

Freshman

  • 0 Playlists
  • 0 Followers

kuldeep Singh

Freshman

  • 0 Playlists
  • 0 Followers

Kalyan Shetti

love listening music, playing guitar, shell scripting

  • 0 Playlists
  • 0 Followers

syafrizalw

Freshman

  • 0 Playlists
  • 0 Followers

Eng Soly

أنتِ جميلةٌ كوطنٍ محرر ... وأنا مُتعبٌ كوطنٍ محتل

  • 0 Playlists
  • 0 Followers

inestestes

Freshman

  • 0 Playlists
  • 0 Followers

Dante Greyson

Freshman

  • 2 Playlists
  • 1 Followers

Naveen Srivatsav

Freshman

  • 10 Playlists
  • 0 Followers

Jonathan Arnold

Interaction Designer at @pixoona, likes taking pictures & loves Jesus.

  • 0 Playlists
  • 0 Followers

tastebuder

Freshman

  • 0 Playlists
  • 0 Followers

dilleydalley

Freshman

  • 0 Playlists
  • 0 Followers

Givi K.

Software Engineer

  • 1 Playlists
  • 0 Followers

Marek Rakowski

Freshman

  • 0 Playlists
  • 0 Followers

Atiaa

And the worlds gonna know your name. ♊️ #TEDxMansUni

  • 0 Playlists
  • 0 Followers

Danny Giebe

Front-End Developer and UI Designer

  • 4 Playlists
  • 281 Followers

Conor Driscoll

Freshman

  • 0 Playlists
  • 0 Followers

Ashok Chowdary

Freshman

  • 0 Playlists
  • 0 Followers

J. De Leon

A creative digital entrepreneur with a passion for building creative and useful digital products.

  • 0 Playlists
  • 0 Followers

Gyán Santokhi

Freshman

  • 0 Playlists
  • 0 Followers
Load more

Delete your comment

Are you sure you want to delete your comment?