Skip to content

Instantly share code, notes, and snippets.

View doganaysahins's full-sized avatar
🦍
iOS enjoyer

Doganay Sahin doganaysahins

🦍
iOS enjoyer
View GitHub Profile
@JamesSedlacek
JamesSedlacek / View+OpenUrl.swift
Last active June 30, 2025 13:50
This file provides a safe way to open URLs in SwiftUI applications.
//
// View+OpenUrl.swift
//
// Created by James Sedlacek on 11/26/24.
//
/// This file provides a safe way to open URLs in SwiftUI applications.
/// It adds a view modifier that handles URL opening with user confirmation
/// and multiple opening options (browser, in-app, or copy to clipboard).
///
@JamesSedlacek
JamesSedlacek / KeyboardToolbar.swift
Last active March 19, 2026 16:25
SwiftUI Keyboard Toolbar Workaround
//
// KeyboardToolbar.swift
//
// Created by James Sedlacek on 9/20/23.
//
import SwiftUI
import Combine
@Observable
import SwiftUI
struct SelectedButton: View {
@State var tabButtons = tabs[0]
@Namespace var animation
var body: some View {
VStack {
HStack {
ScrollView(.horizontal, showsIndicators: false) {
class PaymentViewModel : ObservableObject{
@Published var isLoadingRetrieveProducts = false
@Published var yearlySubscriptionPrice = ""
@Published var monthlySubscriptionPrice = ""
@Published var lifetimeSubscriptionPrice = ""
@Published var isLoadingPayment = false
@Published var showAlert = false
//
// WeatherAPIClient.swift
// WeatherApp
//
// Created by Bahalek on 2021-12-25.
//
import Foundation
import CoreLocation
import SwiftUI
@seanwoodward
seanwoodward / ContactPickerButton.swift
Last active May 27, 2024 03:31
Using CNContactPickerViewController from SwiftUI View
import SwiftUI
import Contacts
import ContactsUI
struct SomeView: View {
@State var contact: CNContact?
var body: some View {
VStack {
Text("Selected: \(contact?.givenName ?? "")")
@boraseoksoon
boraseoksoon / .swift
Created April 7, 2021 21:09
[SwiftUI] Admob Interstitial for SwiftUI
import SwiftUI
import GoogleMobileAds
import UIKit
#if DEBUG
let adUnitID = "yourUnitID"
#else
let adUnitID = "yourUnitID"
#endif
@buh
buh / ReadFrame.swift
Last active June 6, 2024 12:32
SwiftUI view extension to read the frame and bind it to the reader.
//
// Created by Alexey Bukhtin on 26/03/2021.
//
import SwiftUI
extension View {
/// Reads the view frame and bind it to the reader.
/// - Parameters:
@ryanlintott
ryanlintott / CustomColorScheme.swift
Last active January 19, 2026 09:47
Custom color scheme view modifier for SwiftUI. Sets the color scheme to light mode, dark mode, or matches the system. If set to match, the app will respond to system-wide color scheme changes properly. A simple widget color scheme implementation is also provided.
import SwiftUI
enum CustomColorScheme: Int, CaseIterable, Identifiable, Codable {
static var defaultKey = "customColorScheme"
static var defaultValue = CustomColorScheme.system
case system = 0
case light = 1
case dark = 2
@mzeryck
mzeryck / mz_invisible_widget.js
Last active March 11, 2026 13:37
A Scriptable script that creates "invisible" widget backgrounds based on your iOS wallpaper, and then either uses them as a Scriptable widget background or exports to your camera roll.
/*
MIT License
Copyright (c) 2024 Maxwell Zeryck
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTW