Skip to content

Instantly share code, notes, and snippets.

View EnesKaraosman's full-sized avatar
🏠
Working from home

Enes Karaosman EnesKaraosman

🏠
Working from home
View GitHub Profile
@EnesKaraosman
EnesKaraosman / PacMan.swift
Last active April 16, 2020 03:54
PacMan Custom Shape
extension CGRect {
var center: CGPoint {
return .init(x: self.midX, y: self.midY)
}
}
struct PacMan: Shape {
var endAngle: Angle
@EnesKaraosman
EnesKaraosman / Extension+Path.swift
Last active April 15, 2020 16:27
Path methods.
// Okunabilirliği arttırmak amaçlı, düzenleme yaptım.
extension Path {
/// Begins a new subpath at the specified point.
func move(to p: CGPoint)
/// Appends a straight line segment from the current point to the
/// specified point.
func addLine(to p: CGPoint)
@EnesKaraosman
EnesKaraosman / RandomColor.swift
Last active July 14, 2023 09:35
Generatin random color in SwiftUI & UIKit
#if canImport(UIKit)
import UIKit
extension UIColor {
static var random: UIColor {
return UIColor(
red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1)
)
@EnesKaraosman
EnesKaraosman / AppDelegate.swift
Last active January 26, 2020 14:11
Environment enum usage in AppDelegate
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// ..
self.setupNetworkEnvironment()
return true
@EnesKaraosman
EnesKaraosman / Environment.swift
Created January 26, 2020 13:35
Environment file for Settings.bundle demo
enum Environment: String {
case production = "production"
case development = "development"
var url: String {
switch self {
case .development:
return "https://development.base.url/"
case .production:
return "https://production.base.url/"