꾸준히 안타치기

정적변수 Static 본문

iOS/Basic Study

정적변수 Static

글자줍기 2023. 4. 14. 10:20
반응형

정적변수 (Static 변수) :

인스턴스 생성없이도 사용가능함

한 번 선언이 되면 변수가 사용 가능한 영역을 벗어나도 메모리에 기억되어 사라지지 않는 변수를 말합니다.

static 변수를 선언하게 되면 다시 함수를 호출하여도 초기화가 되지 않고 지난 값들을 기억하고 있다가 다시 그 값을 불러들이게 됩니다.

 

정적 변수는 클래스의 모든 인스턴스 또는 객체 간에 값이 공유되는 변수입니다. 

변수를 정적으로 정의하면 객체가 아닌 클래스에 연결됩니다. 정적 변수의 메모리는 클래스 로딩 시간 동안 할당됩니다.

https://www.tutorialspoint.com/where-and-how-to-use-static-variable-in-swift

 

Where and how to use static variable in swift

Where and how to use static variable in swift - Before we see where and how to use static variable, let us first understand, What is static variable in swift?Static VariableStatic variables are those variables whose values are shared among all the instance

www.tutorialspoint.com

https://varyeun.tistory.com/entry/%EC%8A%A4%EC%9C%84%ED%94%84%ED%8A%B8%EC%97%90%EC%84%9C-static-%ED%82%A4%EC%9B%8C%EB%93%9C%EB%9E%80-static-in-swift

 

스위프트에서 static 키워드란? 'static' in swift

부제 : 어제 읽었는데 오늘 아침되니 까먹어서 결국 정리하는 글 "스위프트에서 Static은 '타입' 프로퍼티 혹은 '타입' 함수를 의미한다. 'static'과 'class' 프로퍼티/함수와의 차이점은 'class' 프로퍼

varyeun.tistory.com

 

https://blog.yagom.net/538/

 

Swift에서 Objective-C의 상수 대체제에 관하여 - yagom's blog

yagom's blog Swift에서 Objective-C의 상수 대체제에 관하여

blog.yagom.net

https://blog.yagom.net/182/

 

C . 변수의 범위 - yagom's blog

yagom's blog C <13>. 변수의 범위

blog.yagom.net

 

https://varyeun.tistory.com/entry/%EC%8A%A4%EC%9C%84%ED%94%84%ED%8A%B8%EC%97%90%EC%84%

반응형

'iOS > Basic Study' 카테고리의 다른 글

Throw / try / do catch  (0) 2023.04.18
escaping closure  (0) 2023.04.14
Completion handler  (0) 2023.04.06
iOS로드맵 / swiftUI  (0) 2023.01.12
App's Life Cycle 화면생명주기, AppDelegate, SceneDelegate  (0) 2022.12.15
Comments