본문 바로가기

전체 글47

[Readable Coding Practice] Fetching data from REST API with URLSession In order to provide data from network, I usually use singleton class. In the class I make a data fetching function. Coding this function usually gets messy and hard to read. I used enum to make codes in the function more readable. class NetworkManager { static let shared = NetworkManager() let baseUrl = "http://api.github.com/users/" private init(){ } func getFollowers(for username: String, page.. 2021. 6. 18.
How to setup UINavigation programmatically In scene delegate class you have to set up like this func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { window?.rootViewController = UINavigationController(rootViewController: BaseViewController()) window?.makeKeyAndVisible() guard let _ = (scene as? UIWindowScene) else { return } } then you need main vc that begins when th.. 2021. 6. 6.
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.
Solar Planet AR This app does not collect any kind of personal data 2021. 5. 22.
Adrenalist does not collect any personal information Adrenalist the workout app does not collect any kind of personal information. 2021. 5. 6.
HongKong Skyline (2021) 2021. 1. 15.
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.