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
// | |
// ContentView.swift | |
// Emitter | |
// | |
// Created by localuser on 18.04.23. | |
// | |
import SwiftUI | |
import Combine | |
import Algorithms |
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
import SwiftUI | |
import CommonCrypto | |
struct AsyncImage<Content> : View where Content: View { | |
enum Error : Swift.Error { | |
case invalidData | |
} | |
private let url: 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
class YourCustomWS: ClassicObserver, LifecycleHandler { | |
var pingTask: RepeatedTask? | |
var waitForPongAttempts: [WaiterForPongAttempt] = [] | |
public required init (app: Application, key: String, path: String, exchangeMode: ExchangeMode) { | |
super.init(app: app, key: key, path: path, exchangeMode: exchangeMode) | |
pingTask = app.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(5), delay: .seconds(5)) { [weak self] task in | |
guard let self = self else { return } | |
self.waitForPongAttempts.enumerated().forEach { i, object in | |
if object.attempt >= 2 { |
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 Notification.Name { | |
static let taskAddedNotification = Notification.Name("TaskAddedNotification") | |
} | |
struct ListenToNotificationChanges: View { | |
@State private var newTask: String? | |
var body: some View { | |
VStack { |
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
// ºººº----------------------------------------------------------------------ºººº \\ | |
// | |
// Credit Hamad Fuad. | |
// | |
// Author: Hamad Fuad | |
// Email: [email protected] | |
// | |
// Created At: 24/01/2022 | |
// Last modified: 24/01/2022 | |
// |
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
// ºººº----------------------------------------------------------------------ºººº \\ | |
// | |
// Credit Hamad Fuad. | |
// | |
// Author: Hamad Fuad | |
// Email: [email protected] | |
// | |
// Created At: 24/01/2022 | |
// Last modified: 24/01/2022 | |
// |
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 ScrollViewOffsetPreferenceKey: PreferenceKey { | |
static var defaultValue: CGPoint = .zero | |
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) { | |
value = nextValue() | |
print("value = \(value)") | |
} | |
typealias Value = 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
#if DEBUG | |
import SwiftUI | |
private let screenshotDirectory = "/Users/inket/Desktop/" | |
struct PreviewScreenshot: ViewModifier { | |
struct LocatorView: UIViewRepresentable { | |
let tag: Int | |
func makeUIView(context: Context) -> UIView { |
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
// | |
// CodableExtensionExample.swift | |
// | |
// Created by Pramod Kumar on 05/15/20. | |
// Copyright © 2020 Swift Commmunity. All rights reserved. | |
// | |
import UIKit | |
let json = """ |
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
import UserNotifications | |
// 1. Request Permission | |
func requestAuthorization() { | |
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { (granted, error) in | |
if granted { | |
// Success | |
} else { | |
// Error | |
print(error?.localizedDescription) |
NewerOlder