Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!
NOTE: that this is current, 10/1/2021 state.
- Install Xcode from App Store or install Command Line Tools on your Mac
| // | |
| // Do not edit! File generated using SwiftGen — https://github.com/SwiftGen/SwiftGen | |
| // | |
| // SwiftUI Template by Felix Mau – https://felix.hamburg | |
| // | |
| // Latest version available at https://gist.github.com/fxm90/d1eb5439ad0f45d727bdb98132e933a6 | |
| // | |
| import SwiftUI |
| extension Publisher where Self.Failure == Never { | |
| public func assignNoRetain<Root>(to keyPath: ReferenceWritableKeyPath<Root, Self.Output>, on object: Root) -> AnyCancellable where Root: AnyObject { | |
| sink { [weak object] (value) in | |
| object?[keyPath: keyPath] = value | |
| } | |
| } | |
| } |
| extension Result { | |
| func tryMap<T>(_ transform:(Success) throws -> T) -> Result<T, Swift.Error> { | |
| switch self { | |
| case let .success(success): | |
| do { | |
| return .success(try transform(success)) | |
| } catch { | |
| return .failure(error) | |
| } | |
| case let .failure(failure): |
| /// Perform an immediate mutation of `subject`. The `transform` function may | |
| /// just mutate the given `subject` or replace it entirely. | |
| /// | |
| /// - Parameters: | |
| /// - subject: A value to be transformed. | |
| /// - transform: A closure that mutates or replaces the `subject`. | |
| @inlinable func with<T>(_ subject: T, _ transform: (_ subject: inout T) throws -> Void) rethrows -> T { | |
| var subject = subject | |
| try transform(&subject) | |
| return subject |
| @propertyWrapper struct MustInjected<Value> { | |
| private var _value: Value! = nil | |
| #if DEBUG | |
| let line: UInt | |
| let file: StaticString | |
| #endif | |
| @available(*, unavailable) | |
| init(wrappedValue: @autoclosure @escaping () -> Value) { | |
| self._value = nil | |
| line = #line |
Here is easy steps to try Windows 10 on ARM or Ubuntu for ARM64 on your Apple Silicon Mac. Enjoy!
NOTE: that this is current, 10/1/2021 state.
| //Orginal code from: https://gist.github.com/mecid/f8859ea4bdbd02cf5d440d58e936faec | |
| //I just made some modification in appearnce, show monthly navigator and weekdays. | |
| import SwiftUI | |
| struct ContentView: View { | |
| @Environment(\.calendar) var calendar | |
| private var year: DateInterval { | |
| calendar.dateInterval(of: .month, for: Date())! |
| import Combine | |
| import Foundation | |
| extension NSObjectProtocol where Self: NSObject { | |
| /// Assigns each unique element assigned to the key paths specified to the inverse object. | |
| func bidirectionallyAssign<Value: Equatable, B: NSObject>( | |
| from firstKeyPath: ReferenceWritableKeyPath<Self, Value>, | |
| to secondKeyPath: ReferenceWritableKeyPath<B, Value>, | |
| on otherObject: B | |
| ) -> [AnyCancellable] { |
| import Combine | |
| /// Classes implementing this protocol can be target of convenience Publisher | |
| /// bindings and assignments without causing accidental retain cycles. | |
| /// Those bindings and assignments are also released together with the target. | |
| /// | |
| /// For example: | |
| /// | |
| /// aPublisher.bind(to: self) { me, object in |
| // TODO: setting window transforms (or mission control) flattens layers... | |
| // TODO: Mask image vs path (layer)? | |
| /// `NSVisualEffectView`: | |
| /// | |
| /// A view that adds translucency and vibrancy effects to the views in your interface. | |
| /// When you want views to be more prominent in your interface, place them in a | |
| /// backdrop view. The backdrop view is partially transparent, allowing some of | |
| /// the underlying content to show through. Typically, you use a backdrop view | |
| /// to blur background content, instead of obscuring it completely. It can also |