Skip to content

Instantly share code, notes, and snippets.

Winning The Life

Seyhun Akyürek seyhunak

Winning The Life
View GitHub Profile
seyhunak / EmployeeApiService.swift
Last active Jul 21, 2020
Swift 5 - MVVM - ViewController, ViewModel, Model, Datasource, Webservice
View EmployeeApiService.swift
import Foundation
class APIService : NSObject {
private let sourcesURL = URL(string: "")!
func apiToGetEmployeeData(completion : @escaping (Employees) -> ()){
URLSession.shared.dataTask(with: sourcesURL) { (data, urlResponse, error) in
if let data = data {
let jsonDecoder = JSONDecoder()
let empData = try! jsonDecoder.decode(Employees.self, from: data)
View AppDelegate.swift
import Lokalise
func applicationDidBecomeActive(_ application: UIApplication) {
Lokalise.shared.checkForUpdates { _, _ in }
seyhunak / AnalyticsManager.swift
Last active Jun 14, 2020
AnalyticsManager - Multiple Analytics Provider - Google, Firebase, Mixpanel, Facebook
View AnalyticsManager.swift
import UIKit
import Firebase
import FirebaseAnalytics
//MARK - Analytics Service
protocol AnalyticsService {
func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
func track(event: AnalyticsEvent, parameters: [AnalyticsEventParameter : String])
var trackingEvents: [AnalyticsEvent] { get }
seyhunak / DispatchQueue+Extensions.swift
Created Jun 2, 2020
DispatchQueue extension for situations where one needs to run an expensive operation in background and then use its result in the main thread
View DispatchQueue+Extensions.swift
import Foundation
extension DispatchQueue {
func asyncConsumeInMainQueue<T>(
work: @escaping () throws -> T,
mainSuccess: @escaping (T) -> Void,
mainError: @escaping (Error) -> Void) {
async {
do {
let result = try work()
View AnalyticsManager.swift
import UIKit
public protocol AnalyticsServiceType {
var trackedEvents: [AnalyticsSectionEvent] { get }
func initialize(application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
func track(event: AnalyticsEvent)
extension AnalyticsServiceType {
func shouldTrack(event: AnalyticsSectionEvent) -> Bool {
seyhunak / DispatchGroup+Complete.swift
Created Dec 5, 2019 — forked from plummer/DispatchGroup+Complete.swift
DispatchGroup convenience wrapper for executing a series of blocks concurrently
View DispatchGroup+Complete.swift
import Foundation
extension DispatchGroup {
/// Completes a series of blocks and finally executes a completion handler.
/// - Parameters:
/// - label: An optional DispatchQueue label (defaults to bg)
/// - qos: An optional DipatchQos (defaults to background)
/// - blocks: The series of blocks to call.
View DynamicValue.swift
import Foundation
typealias CompletionHandler = (() -> Void)
class DynamicValue<T> {
var value : T {
didSet {
seyhunak / git-clearHistory
Created Aug 30, 2019 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin<YOUR ACCOUNT>/<YOUR REPOS>.git
seyhunak /
Created Dec 12, 2017 — forked from willurd/
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
View Refreshable.swift
@objc protocol Refreshable
/// The refresh control
var refreshControl: UIRefreshControl? { get set }
/// The table view
var tableView: UITableView! { get set }
/// the function to call when the user pulls down to refresh
@objc func handleRefresh(_ sender: Any);