Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- MainScheduler.Instance
- SRP
- IOS
- DynamicMemberLookup
- 프로그래머스
- 등굣길
- rxswift
- CoreBluetooth
- MethodSwilzzling
- swift
- MainScheduler
- combine
- SwiftUI
- SeSAC
- DispatchQueue
- DiffableDataSource
- data_structure
- 오픈채팅방
- GIT
- GCD
- DependencyInjection
- cleanarchitecture
- 청년취업사관학교
- 코테
- MainScheduler.asyncInstance
- gitflow
- RaceCondition
- 명품cppProgramming c++
- Realm
- leetcode
Archives
- Today
- Total
Do.
Swift - Function Notation 본문
Function Notation은 함수를 표시하는 법을 뜻한다.
func viewDidLoad()
뷰 컨트롤러에 viewdidLoad라는 메서드가 있다는 것은 다들 알 것이다.
이를 표기할때는 `viewDidLoad()` 로 표시하면 된다. 인자가 있는 함수의 경우는 어떨까?
다음은 SceneDelegate에 있는 메서드 중 하나이다.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
이런 경우는 어떻게 써야할까? 복사 붙여넣기 해서 길에 늘여써야 할까?
아니다
swift 에서는 이를
scene(_:willConnectTo:options:)
로 표시한다. 표시할 때는 외부에 보여지는 레이블 이름을 붙이며, 없는 경우는 언더바로 처리한다.
그리고 뒤에 타입을 명시하지 않고 콜론으로 구분한다.
'iOS' 카테고리의 다른 글
iOS 15.0 UIButton (0) | 2022.02.09 |
---|---|
Swift, Concurrency (0) | 2022.02.09 |
Swift - Any vs AnyObject (0) | 2022.02.09 |
Swift - associatedtype in protocols (0) | 2022.02.09 |
(!!) Xcode is not installed (0) | 2022.02.09 |
Comments