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 UIKit | |
| extension UIBezierPath { | |
| /** | |
| Draws the super-elliptic analog of a rounded rect. Unlike the regular rounded rect, the rounded corners | |
| are the quadrants of a superellipse (i.e., parabolic segments), _not_ circular arcs. | |
| If `rect` is a square and `cornerRadius` is equal to half the length or more, and actual superellipse is | |
| drawn (no straight sections along its boundary) just like doing the same with a rounded rect results in a | |
| circle being drawn. |
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/zsh | |
| # pkgAndNotarize.sh | |
| # 2019 - Armin Briegel - Scripting OS X | |
| # place a copy of this script in in the project folder | |
| # when run it will build for installation, | |
| # create a pkg from the product, | |
| # upload the pkg for notarization and monitor the notarization status |
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 UIKit | |
| #if canImport(SwiftUI) && DEBUG | |
| import SwiftUI | |
| struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable { | |
| let viewController: ViewController | |
| init(_ builder: @escaping () -> ViewController) { | |
| viewController = builder() | |
| } |
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 SwiftUI | |
| struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable { | |
| // MARK: - Coordinator | |
| final class Coordinator: NSObject, UIScrollViewDelegate { | |
| // MARK: - Properties | |
| private let scrollView: UIScrollView | |
| var offset: Binding<CGPoint> |
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
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // munged from https://github.com/simontime/Resead | |
| namespace sead | |
| { | |
| class Random | |
| { |
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 SwiftUI | |
| private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) | |
| struct LinkColoredText: View { | |
| enum Component { | |
| case text(String) | |
| case link(String, URL) | |
| } | |
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
| // Usage | |
| let pixelBuffer: CVImageBuffer? = createPixelBufferFrom(image: image) // see https://gist.github.com/rampadc/10a7dc257552f1fb86c1fcc2d1671bd9 | |
| let sampleBuffer: CMSampleBuffer? = createSampleBufferFrom(pixelBuffer: pixelBuffer) | |
| // Function | |
| func createSampleBufferFrom(pixelBuffer: CVPixelBuffer) -> CMSampleBuffer? { | |
| var sampleBuffer: CMSampleBuffer? | |
| var timimgInfo = CMSampleTimingInfo() | |
| var formatDescription: CMFormatDescription? = nil |
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 Array { | |
| func parallelMap<T>(transform: (Element) -> T) -> [T] { | |
| var result = ContiguousArray<T?>(repeating: nil, count: count) | |
| return result.withUnsafeMutableBufferPointer { buffer in | |
| DispatchQueue.concurrentPerform(iterations: buffer.count) { idx in | |
| buffer[idx] = transform(self[idx]) | |
| } | |
| return buffer.map { $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
| // | |
| // ContentView.swift | |
| // MadeForYouCard | |
| // | |
| // Created by AppleDesignDev on 1/24/22. | |
| // | |
| import SwiftUI | |
| struct ContentView: View { |