본문 바로가기

Programming24

How to setup UITabBar programmatically Set like this in scenedelegate class func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window?.rootViewController = BaseViewController() guard let _ = (scene as? UIWindowScene) else { return } } You need to make a baseViewController that can hold viewcontrollers. import UIKit class BaseViewController: UITabBarController { .. 2021. 6. 6.
Adrenalist does not collect any personal information Adrenalist the workout app does not collect any kind of personal information. 2021. 5. 6.
operator Overloading CMy_String. class CMy_String { public: CMy_String(); CMy_String(const char* str); CMy_String(const CMy_String& other); CMy_String& operator=(const CMy_String& rhs); ~CMy_String(); CMy_String operator+(const CMy_String& str); CMy_String operator+(char* str); friend CMy_String operator+ (const char* lhs, CMy_String& rhs); CMy_String& operator+= (const CMy_String& str); CMy_String& operator+= (char.. 2021. 1. 7.
pair와 make_pair의 차이 pair는 data type을 명시해줘야한다. make_pair는 data type을 명시해줄 필요가 없다. map combined; combined.insert(pair(it->first, it->second)); combined.insert(make_pair(it->first, it->second)); 위의 두개는 같은 동작을 한다. 2020. 12. 6.
[Swift] Optional Unwrapping과 Nil Coalescing Optional Unwrapping방법에는 다음과 같은 것들이 있다. 1. Forced Unwrapping 2. Optional Binding (if let, guard 방법) 1. Forced Unwrapping 이 방법은 가장 간단하게 옵셔널의 값을 추출하는 방법이다. 그러나 가장 위험한 방법이기도 하다. Run Time 오류가 일어날수 있기 때문이다. 그렇기에 왠만하면 사용하지 않는 것이 옳다. var myNumber: Int? = 1 print(myNumber) // optional(1) print(myNumber!) // 1 //Forced Unwrapping 방법 2. Optional Binding 이 방법은 if let이나 guard를 사용하여서 해당 값이 nil인지 아닌지를 판별하여서 옵셔.. 2020. 10. 30.
Garbage Collection & Reference Counting 자동 메모리 관리를 통해서 프로그래머의 실수를 방지함으로써 결과적으로는 메모리 누수를 방지할수 있다. 자동 메모리 관리를 위해서 사용하는 방법에는 2가지 방법들이 있다. 1. Garbage Collection - 보통 Tracing Garbage Collection을 의미 2. Reference Counting 지금 살펴 볼것은 Garbage Collection이다. Garbage Collecting Garbage Collection(GC) 작동 원리: - gc는 주기 적으로 사용하지 않는 메모리들을 collect를 한다. - gc는 여유 메모리가 모자를때 collect를 한다. - gc는 Root를 확인한다. gc는 heap에 있는 메모리를 Root를 통해 접근이 가능한지 판단한다. 이때 접근이 불가능.. 2020. 10. 22.
[Swift] Struct vs. Class 언제 사용? Struct를 써야할때 1. 두 Object를 같다, 다르다 로 비교해야 하는 경우 2. Copy된 각 객체들이 독립적인 상태를 가져야하는 경우 3. 코드에서 Object의 데이터를 여러 thread 걸쳐 사용할 경우 Class를 써야할때 1. 두 Object의 instance 자체가 같음을 확인해야 할때 2. 하나의 객체가 필요하고, 여러대상에 의해 접근되고 변경이 필요한 경우 2020. 10. 22.
메모리 영역 2020. 10. 21.
[Swift] struct와 class struct - instance는 value type이다. - 정의 struct 구조체 이름{ property and method } ex) struct info { var name: String var height: Int } var myInfo1: Info = Info(name: "Kim", height: 100) myInfo1.name = "Koon" //변경 가능 myInfo1.height = 0 // 변경 가능 let myInfo2: Info = Info(name: "Park", height: 110) myInfo2.name = "Soon" //변경 불가 myInfo2.height = 10 //변경 불가 class - instance는 reference type이다. -정의 class 클래스 이.. 2020. 10. 18.