Skip to content

Instantly share code, notes, and snippets.

View asilturk's full-sized avatar
🤓
Talk is cheap, show me the code.

Burak Furkan Asiltürk asilturk

🤓
Talk is cheap, show me the code.
View GitHub Profile
@asilturk
asilturk / .swift
Created December 4, 2018 17:04
MVVM Demo: Protocol
protocol MainViewModelDelegate {
func requestCompleted()
}
@asilturk
asilturk / .swift
Created December 4, 2018 17:05
MVVM demo - ViewModel
class MainViewModel {
var delegate: MainViewModelDelegate?
}
@asilturk
asilturk / .swift
Created December 4, 2018 17:06
MVVM demo - Auxiliary Method
// MARK: - Auxiliary Methods
extension MainViewModel {
func getValues() {
if let path = Bundle.main.path(_: _:) { // ... }
// ... Fetch values from test.json
self.delegate?.requestCompleted()
}
}
@asilturk
asilturk / .swift
Created December 4, 2018 17:06
MVVM demo - ViewController
class MainViewController: UIViewController {
// ...
private lazy var viewModel: MainViewModel = {
let vm = MainViewModel()
vm.delegate = self
return vm
}()
@asilturk
asilturk / .swift
Last active December 4, 2018 17:52
MVVM demo - Model Delegate
// MARK: - MainViewModelDelegate
extension MainViewController: MainViewModelDelegate {
func requestCompleted() {
DispatchQueue.main.async {
self.tblView.reloadData()
}
}
}
@asilturk
asilturk / gist:70b662520407d97aaba5620b57c5c91f
Created February 8, 2019 06:58
Localization - Terminal Command
// Terminal Komutu
find . -type f -name \*.swift -print0 | xargs -0 genstrings -o Base.lproj
@asilturk
asilturk / tutorial_StaticClassVariable.swift
Last active April 29, 2019 11:25
tutorial_StaticClassVariable.swift
class Person {
// static var count = 120
static var count: Int {
return 120
}
class var averageCount: Double {
return 23.6
@asilturk
asilturk / RootViewManager.swift
Created October 1, 2019 15:26
RootViewManager
import UIKit
class RootViewManager {
static func setRootView(_ targetVC: UIViewController) {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.window?.rootViewController = targetVC
}
}
@asilturk
asilturk / LottieAnimation.swift
Last active March 8, 2020 00:22
Lottie animation
//
// ViewController.swift
// demoLottie
//
// Created by Burak Furkan Asilturk on 8.03.2020.
// Copyright © 2020 Burak Furkan Asilturk. All rights reserved.
//
import UIKit
import Lottie
@asilturk
asilturk / corner_radius.xml
Last active June 2, 2020 08:16
Android corner radius xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="200dp"
android:layout_width="200dp">
<item>
<shape android:shape="rectangle">
<solid android:color="#edf2f6"/>