Skip to content

Instantly share code, notes, and snippets.

View fatbobman's full-sized avatar

东坡肘子 fatbobman

View GitHub Profile
@fatbobman
fatbobman / CompoundPredicate.swift
Created February 5, 2024 12:46 — forked from NoahKamara/CompoundPredicate.swift
Combining New Swift Predicates
import Foundation
@available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
/// Allows you to use an existing Predicate as a ``StandardPredicateExpression``
struct VariableWrappingExpression<T>: StandardPredicateExpression {
let predicate: Predicate<T>
let variable: PredicateExpressions.Variable<T>
func evaluate(_ bindings: PredicateBindings) throws -> Bool {
// resolve the variable
@fatbobman
fatbobman / InfiniteScrollChart.swift
Created November 7, 2022 03:59 — forked from beader/InfiniteScrollChart.swift
Infinite Scrollable Bar Chart using Swift Charts
//
// InfiniteScrollChart.swift
// ChartsGallery
//
// Created by beader on 2022/11/3.
//
import SwiftUI
import Charts
@fatbobman
fatbobman / FreeSpaceViewController.swift
Created October 8, 2022 00:14 — forked from kylehowells/FreeSpaceViewController.swift
UIViewController subclass to show both the Settings app displayed free space, and the real free space.
//
// FreeSpaceViewController.swift
// Free Space
//
// Created by Kyle Howells on 04/05/2022.
//
import UIKit
class FreeSpaceViewController: UIViewController {
import SwiftSyntax
import SwiftSemantics
import Foundation
let source = try! String(contentsOf: URL(fileURLWithPath: "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/SwiftUI.framework/Modules/SwiftUI.swiftmodule/arm64e.swiftinterface"))
var collector = DeclarationCollector()
let tree = try SyntaxParser.parse(source: source)
tree.walk(&collector)