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
extension View { | |
/// A view modifier that allows `.refreshable` to work reliably alongside state updates | |
/// that would otherwise cause the refresh task to be cancelled. | |
/// | |
/// In SwiftUI, when a state change triggers a view redraw, any ongoing `.refreshable` task is | |
/// cancelled. This can be problematic if your refresh action or scrolling also updates state. | |
/// | |
/// - Important: | |
/// `.refreshable` remains the preferred view modifier. Use this modifier only if your view | |
/// experiences unexpected task cancellations, as a workaround for this specific issue. |
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
#!/usr/bin/swift | |
import Darwin | |
import Foundation | |
var inputString = CommandLine.arguments.dropFirst().joined(separator: " ") | |
if inputString.isEmpty { | |
while let line = readLine(strippingNewline: false) { | |
inputString += line | |
} |
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
#!/bin/bash | |
################################################################################################### | |
# USAGE | |
################################################################################################### | |
print_usage() { | |
echo -e "Takes screenshots of the pages in the current zoom window" | |
echo -e "\nUsage:" | |
echo -e " ./zoom-screenshots.sh [-d DELAY_BETWEEN_SCREENSHOTS] [-o OUTPUT_DIR]" | |
echo -e "\nFlags (optional):" |
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
@resultBuilder | |
struct ArrayBuilder<Element> { | |
static func buildBlock(_ components: [Element]...) -> [Element] { | |
components.flatMap { $0 } | |
} | |
static func buildExpression(_ expression: Element) -> [Element] { | |
[expression] | |
} | |
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
// | |
// ContentView.swift | |
// Airplane | |
// | |
// Created by Chris Eidhof on 08.02.21. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
function xc { | |
xcodePath=`xcode-select --print-path | grep ".*\.app" -o` | |
if (( $# == 0 )) | |
then | |
xcworkspace=`ls -1 | grep *.xcworkspace | wc -l` | |
xcproject=`ls -1 | grep *.xcodeproj | wc -l` | |
package=`ls -1 | grep Package.swift | wc -l` | |
if (( $xcworkspace > 0 )) |
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 <Foundation/Foundation.h> | |
// VARIABLE must be a variable declaration (NSString *foo) | |
// VALUE is what you are checking is not nil | |
// WHERE is an additional BOOL condition | |
#define iflet(VARIABLE, VALUE) \ | |
ifletwhere(VARIABLE, VALUE, YES) | |
#define ifletwhere(VARIABLE, VALUE, WHERE) \ |
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
- (UIImage *)pointillizedImageFromImage:(UIImage *)image withPointDiameter:(CGFloat)diameter | |
{ | |
CGFloat width = image.size.width; | |
CGFloat height = image.size.height; | |
CGImageRef inImage = [image CGImage]; | |
CFDataRef m_dataRef = CGDataProviderCopyData(CGImageGetDataProvider(inImage)); | |
UInt8* m_pixelBuf = (UInt8*)CFDataGetBytePtr(m_dataRef); | |
UIGraphicsBeginImageContextWithOptions(image.size, YES, 0); |