Hi, I am Suat.
I love functional and compositional side of the programming world.
Extensively use the unix & terminal world.
I am clean and readable code addict.
Java and Swift professional.
I have started Swift language at the time of 1.2 version.
I am also interested in a lot of programming approaches, occasionally writes small tools in Clojure, Python.
This file contains 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 Utils | |
{ | |
static func toGreyish(image:UIImage) -> UIImage? | |
{ | |
guard let colorControlsFilter = CIFilter(name: "CIColorControls") else { return nil } | |
guard let colorExposureFilter = CIFilter(name:"CIExposureAdjust") else { return nil } | |
let ciImage = CIImage(image:image) | |
colorControlsFilter.setValue(ciImage, forKey: kCIInputImageKey) |
This file contains 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
extension RandomAccessCollection{ | |
func randomInt() -> Int? { | |
guard let startNumber = self.first as? Int else { return nil } | |
guard let endNumber = self.last as? Int else { return nil } | |
let rangeNumber = endNumber - startNumber | |
let random = Int(arc4random_uniform(UInt32(rangeNumber))) + startNumber; | |
return random | |
} | |
} |
This file contains 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 | |
typealias ZMBroadcastReceivedBlock = ([AnyHashable: Any]?) -> Void | |
enum ZMLocalBroadcastType: String | |
{ | |
case someMagicHappened | |
func broadcast(with data: [AnyHashable: Any]? = nil) | |
{ |
This file contains 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
// | |
// ZMLocalBroadcastObserver.swift | |
// Zamekan | |
// | |
// Created by Suat Karakusoglu on 11.06.2018. | |
// Copyright © 2018 suat.karakusoglu. All rights reserved. | |
// | |
import Foundation | |
class ZMLocalBroadcastObserver |
This file contains 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 | |
class ZMLocalBroadcastSampleVC: UIViewController { | |
var observerMagicHappened: ZMLocalBroadcastObserver? | |
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
self.observerMagicHappened = ZMLocalBroadcastType.someMagicHappened.observeBroadcast {[weak self] (data) in |
This file contains 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 | |
class ZMLocalBroadcastSampleTriggerVC: UIViewController | |
{ | |
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
ZMLocalBroadcastType.someMagicHappened.broadcast(with: ["magicName": "knockKnockMagic"]) | |
} | |
} |