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
public extension View { | |
func readSize(_ size: Binding<CGSize>) -> some View { | |
modifier(ReadSizeModifier(size: size)) | |
} | |
func readSize(onChange: @escaping (CGSize) -> Void) -> some View { | |
background( | |
GeometryReader { geometryProxy in | |
Color.clear |
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 | |
struct RefreshableScrollView<Content: View>: View { | |
@State private var isRefreshing = false | |
@State private var initialValue: CGFloat = 50 | |
private var threshold: CGFloat = 100 | |
let axes: Axis.Set | |
let showsIndicators: Bool | |
let onRefresh: () async -> Void |
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
// | |
// StatelessData.swift | |
// ticketchain | |
// | |
// Created by Maxence Mottard on 28/08/2022. | |
// | |
import Foundation | |
public enum StatelessData<T> { |
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 TicketShape: Shape { | |
let cornerRadius: CGFloat | |
let center: CGFloat | |
let radius: CGFloat? | |
fileprivate init(cornerRadius: CGFloat, center: CGFloat, radius: CGFloat? = nil) { | |
self.cornerRadius = cornerRadius | |
self.center = center | |
self.radius = radius | |
} |
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
const items = Array.from(document.querySelectorAll('#wwdc22 .collection-items .collection-item')) | |
let videos = {} | |
items | |
.map((item) => ({ | |
title: item.querySelector('.video-title').innerText, | |
url: item.querySelector('.video-image-link').href, | |
image: item.querySelector('.video-image').src, | |
date: Array.from(item.querySelectorAll('span')) |
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
// | |
// Promise+Extension.swift | |
// blockchain-concerts | |
// | |
// Created by Maxence on 29/03/2022. | |
// | |
import Foundation | |
import PromiseKit |
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 | |
struct GenericTextField: UIViewRepresentable { | |
// MARK: States | |
@Binding private var text: String | |
@Binding private var isEditing: Bool | |
@Binding private var isFirstResponder: Bool | |
private var formatText: (String, String) -> (String) = { _, newValue in | |
return newValue |
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
protocol FormURLEncodable { | |
var dictionary: [String: String] { get } | |
} | |
extension FormURLEncodable { | |
func encode() -> Data? { | |
return dictionary | |
.mapValues { $0.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" } | |
.map { "\($0)=\($1)" } | |
.joined(separator: "&") |
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 UIKit | |
import SwiftUI | |
struct ActivityView: UIViewControllerRepresentable { | |
typealias Callback = (_ activityType: UIActivity.ActivityType?, _ completed: Bool, _ returnedItems: [Any]?, _ error: Error?) -> Void | |
let activityItems: [Any] | |
let applicationActivities: [UIActivity]? = nil | |
let excludedActivityTypes: [UIActivity.ActivityType]? = nil | |
let callback: Callback? = nil |
NewerOlder