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 / privacy-policy.html
Created May 3, 2026 09:26
Penjig Privacy Policy
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Penjig – Privacy Policy</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 800px; margin: 40px auto; padding: 0 20px; color: #333; line-height: 1.7; }
h1 { color: #1E70B6; }
h2 { color: #1E70B6; margin-top: 2em; border-bottom: 1px solid #eee; padding-bottom: 6px; }
@EnesKaraosman
EnesKaraosman / MailView.swift
Created December 10, 2020 05:48
Mail composer in SwiftUI
// https://stackoverflow.com/questions/56784722/swiftui-send-email
public struct MailView: UIViewControllerRepresentable {
@Environment(\.presentationMode) var presentation
@Binding var result: Result<MFMailComposeResult, Error>?
public var configure: ((MFMailComposeViewController) -> Void)?
public class Coordinator: NSObject, MFMailComposeViewControllerDelegate {
@Binding var presentation: PresentationMode
@EnesKaraosman
EnesKaraosman / SingleSelectionList.swift
Created July 9, 2020 10:19
Single item selection in a list in SwiftUI
struct SingleSelectionList<Item: Identifiable, Content: View>: View {
var items: [Item]
@Binding var selectedItem: Item?
var rowContent: (Item) -> Content
var body: some View {
List(items) { item in
rowContent(item)
.modifier(CheckmarkModifier(checked: item.id == self.selectedItem?.id))
struct ChatMessage: Identifiable {
var id = UUID()
var user: ChatUser
var messageKind: ChatMessageKind
var isSender: Bool
var date: Date
}
@EnesKaraosman
EnesKaraosman / chat_message_kind.swift
Last active August 4, 2020 10:01
ChatMessageKind
enum ImageLoadingKind {
case local(UIImage)
case remote(URL)
}
enum ChatMessageKind {
case text(String)
case image(ImageLoadingKind)
case location(LocationItem)
case contact(ContactItem)
struct ChatUser: Identifiable {
var id = UUID()
var userName: String
var avatar: UIImage?
}
@EnesKaraosman
EnesKaraosman / PacMan_Animatable.swift
Created April 16, 2020 14:39
PacMan with Animatable Data
struct PacMan: Shape {
var endAngle: Angle
// SwiftUI bu parametre ile,
// gerekli optimizasyonu yapıyor.
var animatableData: Double {
get { endAngle.degrees }
set { endAngle = .degrees(newValue) }
}
@EnesKaraosman
EnesKaraosman / Border-Fill-Stroke.swift
Last active April 16, 2020 12:15
Border-Fill-Stroke
HStack(spacing: 16) {
// 1
Rectangle()
.fill(Color.orange)
.frame(width: 60, height: 60)
// 2
Rectangle()
.stroke(
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))
@EnesKaraosman
EnesKaraosman / Balon.swift
Last active April 16, 2020 12:01
Balloon Shape
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)