Skip to content

Instantly share code, notes, and snippets.

Reda Lemeden kaishin

Block or report user

Report or block kaishin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fitomad
fitomad / SwiftUI_async_image_loading.swift
Last active Aug 1, 2019
A SwiftUI example about async image loading.
View SwiftUI_async_image_loading.swift
//
// ImageLoader.swift
// DubDubKit
//
// Created by Adolfo Vera Blasco on 27/06/2019.
// Copyright © 2019 Adolfo Vera Blasco. All rights reserved.
//
#if os(macOS)
import AppKit
@ohayon
ohayon / DraggableView.swift
Last active Jul 31, 2019
Example of making a reusable `draggable()` modifier for SwiftUI Views
View DraggableView.swift
struct DraggablePita: View {
var body: some View {
Image(uiImage: UIImage(named: "pita.png")!)
.draggable() // Add the new, custom modifier to make this draggable
}
}
// Handle dragging
struct DraggableView: ViewModifier {
@State var offset = CGPoint(x: 0, y: 0)
@maxidorius
maxidorius / notes.md
Last active Sep 29, 2019
Notes on privacy and data collection of Matrix.org
View notes.md

Notes on privacy and data collection of Matrix.org


This version of the document is no longer canonical. You can find the canonical version hosted at Gitlab and Github.

PART 2 IS OUT, INCLUDING THE DISCLOSURE OF A GLOBAL FEDERATION DATA LEAK, AND THE ANATOMY OF A GDPR DATA REQUEST HANDLED BY MATRIX.ORG. SEE THE REPOS ABOVE.

This work is licensed under CC BY-NC-SA 4.0. See Editorial Notes for Attribution details.

View NumbersCollectionView.swift
import SwiftUI
struct NumbersCollectionView : UIViewRepresentable {
@Binding var numbers: [Int]
func makeUIView(context: Context) -> UICollectionView {
let layout = UICollectionViewFlowLayout()
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = .white
@simonliotier
simonliotier / SwiftUI+CustomFonts+DynamicType.swift
Last active Sep 22, 2019
Example of how to get Dynamic Type with custom fonts in SwiftUI
View SwiftUI+CustomFonts+DynamicType.swift
import SwiftUI
/// Example of how to get Dynamic Type with custom fonts in SwiftUI.
struct ContentView: View {
var body: some View {
VStack(spacing: 20) {
Text("A large title").customFont(.largeTitle) // "Optima-ExtraBlack", 28
Text("A body").customFont(.body) // "Kailasa", 16
Text("A caption").customFont(.caption2) // "IowanOldStyle-Italic", 11
}
@brimelow
brimelow / ContentView.swift
Created Jun 13, 2019
Random 100 Circles Animation in SwiftUI
View ContentView.swift
//
// ContentView.swift
// DrawingGroup
//
// Created by Lee Brimelow on 6/12/19.
// Copyright © 2019 Lee Brimelow. All rights reserved.
//
import SwiftUI
@alexito4
alexito4 / RemoteImage.swift
Last active Jun 17, 2019
Rough sketch of SwiftUI RemoteImage using AlamofireImage
View RemoteImage.swift
import SwiftUI
import Combine
import AlamofireImage
let imageDownloader = ImageDownloader(
configuration: ImageDownloader.defaultURLSessionConfiguration(),
downloadPrioritization: .fifo,
maximumActiveDownloads: 4,
imageCache: AutoPurgingImageCache()
)
@insidegui
insidegui / PwnageVerifier.swift
Last active Sep 30, 2018
Uses the pwnedpasswords API to verify password integrity
View PwnageVerifier.swift
/*
By default, this class requires https://github.com/idrougge/sha1-swift to work,
you can replace the default SHA1 implementation by setting the hash property to a function
that takes a String and returns an optional String (the SHA1 hex string of the input)
*/
/// Uses the pwnedpasswords API to verify password integrity
public final class PwnageVerifier {
/// The base URL for the pwnedpasswords service (a default is provided by the initializer)
View Decode Array<Any> and Dictionary<String, Any> Swift
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
@brennanMKE
brennanMKE / Async.swift
Last active Sep 24, 2019
Blocking with Semaphores and DispatchGroups in Swift
View Async.swift
import PlaygroundSupport
import Foundation
class Worker {
private let queue = DispatchQueue.global(qos: .background)
private let serialQueue = DispatchQueue(label: "com.acme.serial")
public private(set) var count = 0
func incrementCount() {
You can’t perform that action at this time.