Using methods in Swift

Опубликовано: 21 Март 2026
на канале: Cody Henrichsen
1,016
2

How to write methods in Swift using the Xcode playground. Includes String interpolation, multiple parameters and comparisons to Java

Table of Contents:

00:22 - Java version of a void method
00:47 - Swift untyped (Void) method
01:34 - java version of a boolean method
02:03 - Swift version of a Bool method
03:31 - calling a Swift method
04:36 - get func-y
05:07 - troubleshooting
06:17 - Note about playground and methods
07:00 - error for calling method before defined in playground
07:51 - more complex method
08:21 - Error indicates return statement not present
08:39 - declare and initialize a variable to return
11:39 - single parameter methods do NOT need a label
14:16 - String concatenation
15:21 - Calling multiple parameter methods
18:18 - Swift methods review