Skip to content

Instantly share code, notes, and snippets.

View eliakorkmaz's full-sized avatar
🎯
Focusing

Emrah Korkmaz eliakorkmaz

🎯
Focusing
View GitHub Profile
private let worker = ProfileViewModelWorker()
private var viewModel: ProfileViewModel!
override func viewDidLoad() {
super.viewDidLoad()
profileViewModel = ProfileViewModel(viewModelWorkable: worker)
profileViewModel.fetchAndTag()
}
import Foundation
protocol ProfileViewModelWorkable {
func fetchProfileAndTagIt(completion: @escaping (Bool) -> Void)
}
class ProfileViewModelWorker: ProfileViewModelWorkable {
func fetchProfileAndTagIt(completion: @escaping (Bool) -> Void) {
fetchProfile { [weak self] result in
guard let self = self else {return}
import Foundation
protocol ProfileViewModelWorkable {
func fetchProfileAndTagIt(completion: @escaping (Bool) -> Void)
}
class ProfileViewModelWorker: ProfileViewModelWorkable {
func fetchProfileAndTagIt(completion: @escaping (Bool) -> Void) {
fetchProfile { [weak self] result in
guard let self = self else {return}
private let networker = ProfileNetworker()
private let tagger = ProfileAnalytic()
private var profileViewModel: ProfileViewModel!
override func viewDidLoad() {
super.viewDidLoad()
profileViewModel = ProfileViewModel(profileNetwork: networker, profileTagger: tagger)
profileViewModel.fetch()
}
import Foundation
struct Profile: Codable {}
protocol ProfileNetworkFetchable {
func fetchProfile(completion: @escaping (Result<Profile,NSError>) -> Void)
}
protocol ProfileAnalyticTaggable {
func tagAnalytics(result: Result<Profile,NSError>)
import UIKit
class MarkdownPreviewViewController: UIViewController {
@IBOutlet weak var markdownTextView: UITextView!
private var markdownPreviewer = MarkdownPreviewer()
override func viewDidLoad() {
super.viewDidLoad()
Task {
let url = "https://www.awesomemarkdownresource.com"
import UIKit
class MarkdownPreviewViewController: UIViewController {
@IBOutlet weak var markdownTextView: UITextView!
private var markdownPreviewer = MarkdownPreviewer()
override func viewDidLoad() {
super.viewDidLoad()
Task {
await prepareMarkdown(from: "https://www.awesomemarkdownresourcetouse.com")
import UIKit
class MarkdownPreviewViewController: UIViewController {
@IBOutlet weak var markdownTextView: UITextView!
override func viewDidLoad() {
super.viewDidLoad()
Task {
await prepareMarkdown(from: "https://www.awesomemarkdownsource.com")
}
@eliakorkmaz
eliakorkmaz / how-to-create-a-cocoa-pod
Created November 22, 2022 09:28 — forked from ccabanero/how-to-create-a-cocoa-pod
How to Create a Cocoa Pod
Notes for Creating a Cocoa Pod
Pod Version: 0.39.0
OS: OS X El Capitain (10.11.3)
- - - - - - - - - - - - - - - - - - - - - - -
1. Install CocoaPods (https://guides.cocoapods.org/using/getting-started.html)
2. Create Xcode project to author the Pod
class BookListViewController: UIViewController { }
class CommentsViewController: UIViewController {
var productId: Int?
}