All you need to know in one place.
Table of contents:
All you need to know in one place.
Table of contents:
| import SwiftUI | |
| struct ContentView: View { | |
| @State private var toggle = false | |
| var body: some View { | |
| CustomParentView { | |
| Button { | |
| toggle.toggle() | |
| } label: { |
| extension UIImage { | |
| @available(iOS 15, *) | |
| var thumbnail: UIImage? { | |
| get async { | |
| let size = CGSize(width: 80, height: 40) | |
| return await self.byPreparingThumbnail(ofSize: size) | |
| } | |
| } | |
| } | |
| enum FetchError:Error{ |
| extension UIHostingController { | |
| convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
| self.init(rootView: rootView) | |
| if ignoreSafeArea { | |
| disableSafeArea() | |
| } | |
| } | |
| func disableSafeArea() { |
Most new PCs don't come with DVD drives anymore. So it can be a pain to install Windows on a new computer.
Luckily, Microsoft makes a tool that you can use to install Windows from a USB storage drive (or "thumbdrive" as they are often called).
But what if you don't have a second PC for setting up that USB storage drive in the first place?
In this tutorial we'll show you how you can set this up from a Mac.
You can download the ISO file straight from Windows. That's right - everything we're going to do here is 100% legal and sanctioned by Microsoft.
| class CircularBuffer<T> { | |
| var bufferMaxSize: Int | |
| var size = 0 | |
| var elements = Array<T?>(repeating: nil, count: 8) | |
| var front: T? { | |
| if isEmpty() { | |
| return nil | |
| } else { |
| import CoreGraphics | |
| import Accelerate | |
| import CoreImage | |
| import UIKit | |
| extension CGImage { | |
| public enum Error: Swift.Error { | |
| case imageResizingFailed | |
| case cgContextCreationFailed |
| # addSubview | |
| UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
| self.view.addSubview(view) | |
| }, completion: nil) | |
| # removeFromSuperview | |
| UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: { | |
| subview.removeFromSuperview() | |
| }, completion: nil) |
| /** A pthread-based recursive mutex lock. */ | |
| public class Mutex { | |
| private var mutex: pthread_mutex_t = pthread_mutex_t() | |
| public init() { | |
| var attr: pthread_mutexattr_t = pthread_mutexattr_t() | |
| pthread_mutexattr_init(&attr) | |
| pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) | |
| let err = pthread_mutex_init(&self.mutex, &attr) |
| // port of http://stackoverflow.com/a/17948778/3071224 | |
| import UIKit | |
| import Foundation | |
| extension CGSize { | |
| static func aspectFit(aspectRatio : CGSize, var boundingSize: CGSize) -> CGSize { | |
| let mW = boundingSize.width / aspectRatio.width; | |
| let mH = boundingSize.height / aspectRatio.height; |