This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Singleton { | |
| static let shared: Singleton = { | |
| let instance = Singleton() | |
| // setup code | |
| return instance | |
| }() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SomeSingletonClass { | |
| static let shared: SomeSingletonClass = SomeSingletonClass() | |
| private init() {} | |
| func foo() { | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Combine | |
| class SignupViewController: UIViewController { | |
| @IBOutlet weak var signupLabel: UILabel! | |
| @IBOutlet weak var errorLabel: UILabel! | |
| @IBOutlet weak var usernameTextField: UITextField! | |
| @IBOutlet weak var passwordTextField: UITextField! | |
| private var cancellables = Set<AnyCancellable>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Combine | |
| class SplashViewController: UIViewController { | |
| @IBOutlet weak var activityIndicator: UIActivityIndicatorView! | |
| private var cancellables = Set<AnyCancellable>() | |
| var launchDataDispatchGroup: DispatchGroup = DispatchGroup() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import Combine | |
| class SignUpViewModel: ObservableObject { | |
| @Published var userProfile: UserProfileModel? | |
| private var cancellables = Set<AnyCancellable>() | |
| func getOnboardingData() { | |
| let publishers = Publishers.Zip( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| import Combine | |
| class ViewController: UIViewController { | |
| @IBOutlet private var userNameTextField: UITextField! | |
| @IBOutlet private var passwordTextField: UITextField! | |
| @IBOutlet private var tncSwitch: UISwitch! | |
| @IBOutlet private var signupButton: SignUpButton! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AircraftView: UIView { | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| setupView() | |
| } | |
| required init?(coder: NSCoder) { | |
| super.init(coder: coder) | |
| setupView() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BoardingPassView: UIView { | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| setupView() | |
| } | |
| required init?(coder: NSCoder) { | |
| super.init(coder: coder) | |
| setupView() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iOS Code Review Checklist | |
| Avoid Type Inference | |
| Prefer using Higher Order Functions | |
| Write DRY code (Don’t Repeat Yourself) | |
| Make sure that there are no force unwraps | |
| Make sure that there are no retain cycles | |
| Check if any deprecated API is being used | |
| Check if any hardcoded checks (generally strings) can be changed to enum. | |
| Prefer enum, switch over if else. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
| guard let serverTrust = challenge.protectionSpace.serverTrust else { | |
| completionHandler(.cancelAuthenticationChallenge, nil); | |
| return | |
| } | |
| let certificate = SecTrustGetCertificateAtIndex(serverTrust, 0) | |
| // SSL Policies for domain name check | |
| let policy = NSMutableArray() |
NewerOlder