Skip to content

Instantly share code, notes, and snippets.

View zafarivaev's full-sized avatar
🎯
Focusing

Zafar Ivaev zafarivaev

🎯
Focusing
View GitHub Profile
name: SimpsonsQuotes
options:
bundleIdPrefix: com.zafar.simpsons-quotes
createIntermediateGroups: true
deploymentTarget:
iOS: 15.0
*.xcodeproj
*.xcworkspace
*.DS_Store
import UIKit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
self.window = window
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}
// MARK: UISceneSession Lifecycle
import UIKit
@IBDesignable class CircularProgressView: UIView {
// MARK: - Initialization
public override init(frame: CGRect) {
super.init(frame: frame)
}
import UIKit
public final class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
// 1
public weak var tableView: UITableView?
// 2
public init(tableView: UITableView) {
self.tableView = tableView
private func bindAvatarToImageView() {
getAvatarFromTheServer()
.handleEvents(receiveSubscription: { [weak self] in
print("Subscribed", $0)
self?.state = .loading
}, receiveOutput: {
print("Got image", $0)
}, receiveCompletion: {
print("Completion", $0)
})
import UIKit
import Combine
...
class ViewController: UIViewController {
...
override func viewDidLoad() {
import UIKit
import Combine
...
class ViewController: UIViewController {
...
private func bindStateToTitle() {
import UIKit
import Combine
...
enum State: String {
case initial = "Initial"
case loading = "Loading"
case loadedSuccessfully = "Success"
case loadingFailed = "Failure"