This file contains 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 | |
// Shared | |
// | |
// Created by Costantino Pistagna on 25/03/21. | |
// | |
import SwiftUI | |
struct ContentView: View { |
This file contains 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 { | |
func iff(_ condition: Bool, _ modifier: (Self) -> AnyView) -> AnyView { | |
if condition { | |
return modifier(self).eraseToAnyView() | |
} | |
return eraseToAnyView() | |
} | |
func some<Value>(_ optional: Value?, modifier: (Value, Self) -> AnyView) -> some View { | |
guard let value = optional else { |
This file contains 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
var fetchedResultsProcessingOperations: [NSBlockOperation] = [] | |
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) { | |
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock)) | |
} | |
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { | |
switch type { | |
case .Insert: |
This file contains 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 | |
import UIKit | |
// Usage Examples | |
let shadowColor = Color.shadow.value | |
let shadowColorWithAlpha = Color.shadow.withAlpha(0.5) | |
let customColorWithAlpha = Color.custom(hexString: "#123edd", alpha: 0.25).value | |
enum Color { | |
This file contains 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/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist |