Skip to content

Instantly share code, notes, and snippets.

View fozoglu's full-sized avatar
👨‍💻

Furkan Ozoglu fozoglu

👨‍💻
View GitHub Profile
@fozoglu
fozoglu / APICallManager.swift
Created May 2, 2018 08:19
API Call Manager file with alamofire and swiftyJSON
import Alamofire
import SwiftyJSON
import Foundation
let API_BASE_URL = "http://api.fozoglu.com"
class APICallManager {
static let instance = APICallManager()
enum RequestMethod {
@fozoglu
fozoglu / viewcontroller.swift
Created November 13, 2017 18:23
Keychain_Example
//
// ViewController.swift
// Keychain_Example
//
// Created by Furkan Ozoglu on 13.11.2017.
// Copyright © 2017 Furkan Ozoglu. All rights reserved.
//
import UIKit
import Locksmith
@fozoglu
fozoglu / RouteResult.json
Created June 7, 2017 08:21
Esri Route Service
{
"messages": [],
"routes": {
"hasM": true,
"fieldAliases": {
"ObjectID": "ObjectID",
"Name": "Name",
"FirstStopID": "FirstStopID",
"LastStopID": "LastStopID",
"StopCount": "StopCount",
@fozoglu
fozoglu / guardExample1.swift
Created February 16, 2017 08:37
Guard kullanımı ile ilgili ufak bir örnek
func writeLabel(firstTextfield: String) -> Int {
guard let d : Int = Int(firstTextfield) else {
let d : Int = 0
print("Değer Yok")
return d
}
print(d)
return d
@fozoglu
fozoglu / openURL.swift
Created February 14, 2017 11:10
openURL hem 10.0 versiyonu hem de eski versiyonlarda çalışması için hazırlanmış bir metot
func open(scheme: String) {
if let url = URL(string: scheme) {
if #available(iOS 10, *) {
UIApplication.shared.open(url, options: [:],
completionHandler: {
(success) in
print("Open \(scheme): \(success)")
})
} else {
let success = UIApplication.shared.openURL(url)
@fozoglu
fozoglu / UIImageView+Extension.swift
Created February 14, 2017 11:09
frameForImageInImageViewAspectFit metotu ile aspectFit ile değişen boyutu yakalayabilirsin.
extension UIImageView{
func frameForImageInImageViewAspectFit() -> CGRect
{
if let img = self.image {
let imageRatio = img.size.width / img.size.height;
let viewRatio = self.frame.size.width / self.frame.size.height;
if(imageRatio < viewRatio)
{
@fozoglu
fozoglu / calculateNet.swift
Last active January 30, 2017 13:53
YGS - LYS için net hesabı
import UIKit
func calculateNet(correct:Int = 0 , wrong:Int = 0 , count:Int = 0) -> (Float) {
var result : Float = 0
if (correct <= count && correct >= 0) && (wrong <= count && wrong >= 0) {
if (correct + wrong <= count){
result = Float(correct) - Float(wrong)/4
@fozoglu
fozoglu / DesignableTextField.swift
Created January 24, 2017 11:32
Custom TextField
import UIKit
@IBDesignable class DesignableTextField: UITextField {
@IBInspectable var borderWidth: CGFloat = 0.0{
didSet{
self.layer.borderWidth = borderWidth
}
@fozoglu
fozoglu / borderUIColor.swift
Created January 24, 2017 08:11
borderUIColor - swift 3 example
extension CALayer {
var borderUIColor: UIColor {
set {
self.borderColor = newValue.cgColor
}
get {
return UIColor(cgColor: self.borderColor!)
}
}
@fozoglu
fozoglu / HealthKitManager.swift
Created January 18, 2017 07:52
HealthKitManager class örneği en sade hali
import HealthKit
class HealthKitManager {
class var sharedInstance: HealthKitManager {
struct Singleton {
static let instance = HealthKitManager()
}
return Singleton.instance