Skip to content

Instantly share code, notes, and snippets.

View manojkarki's full-sized avatar

Manoj Karki manojkarki

View GitHub Profile
/*
Tapping on top button will tap the buttons inside srollview!!!
Fix: Adding zOrder solved the problem
*/
struct TapGoingBehind: View {
@State
var tapMeCount = 0
@State
var rectangleTapCount = 0
/*
Xcode 12.0 Beta 1
Scrolling vertically freezes the App
*/
struct VGridsExample: View {
private var data: [Int] {
(0 ... 2500).map {$0}
}
private var columns: [GridItem] {
Array(repeating: GridItem(.fixed(48),spacing: 0), count: 50)
@manojkarki
manojkarki / GridView.swift
Created May 23, 2020 12:05
A SwiftUi GridView to demonstrate multiple downloads using Combine.
import Foundation
import Combine
import SwiftUI
import UIKit
struct GridView: View {
@ObservedObject
var vm = GridViewModel()
let rows: Int = 25
let options = PHFetchOptions()
options.sortDescriptors = NSSortDescriptor(key:"creationDate" ascending:true)
let photosResult = PHAsset.fetchAssets(mediaType:.Image, options:options)
PHFetchOptions *allPhotosOptions = [PHFetchOptions new];
allPhotosOptions.sortDescriptors = @[[NSSortDescriptor sortDescriptorWithKey:@"creationDate" ascending:YES]];
PHFetchResult *allPhotosResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:allPhotosOptions];
[allPhotosResult enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {