Skip to Main Content
Einfuhrung in Swift 2
book

Einfuhrung in Swift 2

by Holger Hinzberg
November 2015
Intermediate to advanced content levelIntermediate to advanced
344 pages
6h 33m
German
mitp Verlag
Content preview from Einfuhrung in Swift 2

Anhang A: Swift-Lexikon

Alias

Aliasnamen, in der englischen Dokumentation als »Type Alias« bezeichnet, ermöglichen es, für einen bestehenden Typ einen alternativen Namen zu deklarieren. Dieser kann im Code anstelle des ursprünglichen Typs verwendet werden. Ein weiterer Verwendungszweck ist die Benennung von zuvor anonymen Tupeln. Swift erlaubt den Einsatz von Aliasnamen als Parameter und Rückgabewerte von Funktionen und Methoden.

// Alias für einen (Double, Double) Tupel typealias Coordinate = (x:Double, y:Double) let pos1 = Coordinate(y: 44.4, x: 55.4) let pos2 = Coordinate(x: 55.4, y: 44.4) func addCoordinates( c1:Coordinate, c2:Coordinate) -> Coordinate { return Coordinate(x: c1.x + c2.x, y: c1.y + c2.y) } let posSum = addCoordinates(pos1, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Xcode

Beginning Xcode

Matthew Knott
Basiswissen Testautomatisierung

Basiswissen Testautomatisierung

Manfred Baumgartner, Stefan Gwihs, Richard Seidl, Thomas Steirer, Marc-Florian Wendland

Publisher Resources

ISBN: 9783958453166