Skip to content

Instantly share code, notes, and snippets.

View juansanzone's full-sized avatar
📱
Mobile ❤️

Juan Sanzone juansanzone

📱
Mobile ❤️
View GitHub Profile
public final class CustomHostingController<Content>: UIHostingController<Content> where Content: View {
}
@juansanzone
juansanzone / Reachability.swift
Last active June 8, 2022 13:42
JS Reachability
import Foundation
import Network
final class Reachability: ObservableObject {
// MARK: Enum
enum NetworkStatus: String {
case connected
case disconnected
@juansanzone
juansanzone / ImplementationMvp.swift
Last active July 23, 2019 13:53
Security Example
private func confirmPayment() {
let securitymanager = MPSecurityManager(flowUsageDescription: "Para realizar un par seguro")
securitymanager.authorize(onSuccess: {
// Payment success
self.doPayment()
}) { _ in
// TODO: Error - Log
}
@juansanzone
juansanzone / SwiftUI-JSRemoteImage.swift
Created June 29, 2019 15:35
JSRemoteImage + Cache (SwiftUI)
struct JSRemoteImage: View {
@State private var uiImage: UIImage = UIImage()
@ObjectBinding private var remoteImageHandler: JSRemoteImageHandler
init(_ remoteUrl: String?) {
remoteImageHandler = JSRemoteImageHandler(remoteUrl)
}
var body: some View {
Image(uiImage: getImage()).resizable()
@juansanzone
juansanzone / JSRemoteImage.swift
Last active June 29, 2019 14:10
SwiftUI - JSRemoteImage / SwiftUI RemoteImage component using Combine
//
// JSRemoteImage.swift
// Ridit
//
// Created by Juan Sebastian Sanzone on 6/29/19.
// Copyright © 2019 JuanSanzone. All rights reserved.
//
import SwiftUI
import Combine
@juansanzone
juansanzone / JSRemoteImage.swift
Last active June 26, 2019 00:05
Lightweight SwiftUI component to load remote Image as SwiftUI View
//
// JSRemoteImage.swift
// Ridit App
//
// Created by Juan Sebastian Sanzone on 6/24/19.
// Copyright © 2019 @johnsanzo. All rights reserved.
//
import SwiftUI
//
// InstaStories.swift
// SwiftUITests
//
// Created by Fabio Giolito on 23/06/2019.
// Copyright © 2019 Fabio Giolito. All rights reserved.
//
import Combine
import SwiftUI
@juansanzone
juansanzone / GeometryReaderInList.swift
Created June 23, 2019 18:22 — forked from sphilipakis/GeometryReaderInList.swift
Use GeometryReader in List (stretchy headers, etc...)
import SwiftUI
struct ContentView : View {
var body: some View {
List {
HeaderView()
ForEach(0...20) { n in
Text("Row #\(n)")
}
}
import SDWebImage
// ...
func fetchWeatherImage() -> Image {
let imageFileName = weather.iconUrl ?? "01d"
let uiImageView = UIImageView()
uiImageView.sd_setImage(with: URL(string: "https://path/\(imageFileName).png"), completed: nil)
if let image = uiImageView.image {