Skip to content

Instantly share code, notes, and snippets.

View yessenali's full-sized avatar
👋

yessenali yessenali

👋
  • Almaty, Kazakhstan
View GitHub Profile
@JamesSedlacek
JamesSedlacek / View+OpenUrl.swift
Last active April 19, 2025 21: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).
///
import WatchKit
import WatchConnectivity
// Encapsulating in a tuple for don't duplicate code
typealias MessageReceived = (session: WCSession, message: [String : Any], replyHandler: (([String : Any]) -> Void)?)
// 1: Same that before, but to manage ApplicationContextReceived
typealias ApplicationContextReceived = (session: WCSession, applicationContext: [String : Any])
// Protocol for manage all watchOS delegations
protocol WatchOSDelegate: AnyObject {