This file contains hidden or 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
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/" |
This file contains hidden or 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
@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 |
This file contains hidden or 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
#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) | |
) |
This file contains hidden or 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
// 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) |
This file contains hidden or 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 CGRect { | |
var center: CGPoint { | |
return .init(x: self.midX, y: self.midY) | |
} | |
} | |
struct PacMan: Shape { | |
var endAngle: Angle | |
This file contains hidden or 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
HStack { | |
PacMan(endAngle: .degrees(270)) | |
.frame(width: 120, height: 120) | |
// PacMan için, içerisinde çizim yaptığımız | |
// (in rect: CGRect) bu frame' dir. | |
PacMan(endAngle: .degrees(270)) | |
.rotation(.degrees(45)) | |
.frame(width: 120, height: 120) |
This file contains hidden or 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
struct Balon: Shape { | |
func path(in rect: CGRect) -> Path { | |
// Orta - Alt nokta | |
let bottomCenter = CGPoint(x: rect.midX, y: rect.maxY) | |
// Orta - Üst nokta | |
let upCenter = CGPoint(x: rect.midX, y: rect.minY) | |
This file contains hidden or 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
struct Triangle: Shape { | |
func path(in rect: CGRect) -> Path { | |
var path = Path() | |
// Orta - Üst | |
let topCenter = CGPoint(x: rect.midX, y: rect.minY) | |
path.move(to: topCenter) | |
// Sol Kenar | |
path.addLine(to: .init(x: rect.minX, y: rect.maxY)) |
This file contains hidden or 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
HStack(spacing: 16) { | |
// 1 | |
Rectangle() | |
.fill(Color.orange) | |
.frame(width: 60, height: 60) | |
// 2 | |
Rectangle() | |
.stroke( |
This file contains hidden or 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
struct PacMan: Shape { | |
var endAngle: Angle | |
// SwiftUI bu parametre ile, | |
// gerekli optimizasyonu yapıyor. | |
var animatableData: Double { | |
get { endAngle.degrees } | |
set { endAngle = .degrees(newValue) } | |
} |
OlderNewer