Skip to content

Instantly share code, notes, and snippets.

View xmollv's full-sized avatar

Xavi Moll xmollv

View GitHub Profile
import SwiftUI
@main
struct SwiftUIListVSLazyVStackApp: App {
let numbers = (0...100).map { $0 }
var body: some Scene {
WindowGroup {
/*
@xmollv
xmollv / WWDC2020.md
Last active June 23, 2020 09:18
List of all the videos of WWDC2020.

WWDC 2020

Keynote: https://developer.apple.com/videos/play/wwdc2020/101/
Monday@WWDC: https://developer.apple.com/videos/play/wwdc2020/10691/
Platforms State of the Union: https://developer.apple.com/videos/play/wwdc2020/102/
Submit your questions for the cast and creators of Mythic Quest: Raven’s Banquet: https://developer.apple.com/videos/play/wwdc2020/10971/
Adopt the new look of macOS: https://developer.apple.com/videos/play/wwdc2020/10104/
Advances in UICollectionView: https://developer.apple.com/videos/play/wwdc2020/10097/
Advances in diffable data sources: https://developer.apple.com/videos/play/wwdc2020/10045/
Build Metal-based Core Image kernels with Xcode: https://developer.apple.com/videos/play/wwdc2020/10021/

@xmollv
xmollv / AnimatedCheckMark.swift
Created March 28, 2020 12:34
Playground for an animated checkmark/cross view
import UIKit
import PlaygroundSupport
class AnimatedResultView: UIView {
enum Result {
case success
case failure
}
@xmollv
xmollv / Reusable.swift
Last active April 7, 2019 08:39
Reusable generic Cells. It only works with cells created with a .XIB file.
/// This protocol only aggregates the needed properties for the extensions to work and avoid duplicated code.
private protocol Reusable: class {
/// Returns `String(describing: self)` to be used as the `reuseIdentifier`.
static var reuseIdentifier: String { get }
/// Returns the UINib using the `String(describing: self)` as the name of the NIB.
static var nib: UINib { get }
}
private extension Reusable {
static var reuseIdentifier: String {
/// Source: https://bitbucket.org/mmick66/centercellpagingcollectionview
class CenterCellCollectionViewFlowLayout: UICollectionViewFlowLayout {
var mostRecentOffset = CGPoint()
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard let collectionView = self.collectionView else {
self.mostRecentOffset = super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
return self.mostRecentOffset