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 | |
infix operator ??? | |
extension Optional where Wrapped: Collection { | |
/// Performs a nil-coalescing operation, returning the wrapped value of an `Optional` instance | |
/// only if the wrapped value is not empty, otherwise returns a default value. | |
/// | |
/// - Parameters: |
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
// | |
// CheckboxToggleStyle.swift | |
// | |
// Created by Felix Mau on 25.05.2021. | |
// Copyright © 2021 Felix Mau. All rights reserved. | |
// | |
/// A fully configurable toggle style for SwiftUI, making the Toggle look like a checkbox. | |
struct CheckboxToggleStyle: ToggleStyle { |
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 UIKit | |
import SwiftUI | |
extension FloatingPoint { | |
var degreesToRadians: Self { self * .pi / 180 } | |
var radiansToDegrees: Self { self * 180 / .pi } | |
} | |
struct Donut: Identifiable { | |
var id = UUID() |
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 CoreData | |
import SwiftUI | |
struct ContentView : View { | |
var request: FetchRequest<Task> | |
init(taskID: Int) { | |
self.request = FetchRequest<Task>(fetchRequest: ContentViewTest.taskRequest(taskID: taskID)) | |
} | |
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 os, os.path, sys, urllib2, requests | |
class PyPiError(Exception): | |
def __init__(self, value): | |
self.value = value | |
def __str__(self): | |
return repr(self.value) | |
def _chunk_report(bytes_so_far, chunk_size, total_size): | |
if (total_size != None): |