Adopted from: https://techinfluence.net/turn-off-mouse-acceleration-on-mac/#Method_2_Turn_Off_Mouse_Acceleration_Using_the_Terminal
Check the current value of scaling in user defaults:
~ defaults read .GlobalPreferences com.apple.mouse.scaling
This will display a hidden preference setting that you can change by altering the number at the end. If the mouse acceleration feature is enabled, the above command should display a value between 0 and 3. This is the value that is altered when you move the ‘Tracking Speed’ slider
Disable mouse acceleration:
// | |
// SkeletonGradientAnimationView.swift | |
// Mimir | |
// | |
// Created by Grant Davis on 3/18/22. | |
// Copyright © 2022 Grant Davis Interactive, LLC. All rights reserved. | |
// | |
import Foundation | |
import SwiftUI |
### -------------------------------------------------------------------------------------------------- | |
# | |
# The code below has been adotped and modified from https://stackoverflow.com/a/68022221/189292 | |
# This allows the project to increment build numbers on a per-target basis, instead of updating the entire | |
# project for all targets when using the standard `increment_build_number` lane. | |
# | |
### -------------------------------------------------------------------------------------------------- | |
# Sets the "BUILD" number for a target | |
# |
<key>GDI Commands</key> | |
<dict> | |
<key>GDI Duplicate Current Line</key> | |
<string>selectLine:, copy:, moveToEndOfLine:, insertNewLine:, moveToBeginningOfLine:, paste:, moveUp:, moveToEndOfLine:</string> | |
<key>GDI Delete Current Line</key> | |
<string>moveToEndOfLine:, deleteToBeginningOfLine:, deleteBackward:, moveDown:, moveToEndOfLine:</string> | |
<key>GDI Move Current Line Up</key> | |
<string>selectLine:, cut:, moveUp:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string> | |
<key>GDI Move Current Line Down</key> | |
<string>selectLine:, cut:, moveDown:, moveToBeginningOfLine:, insertNewLine:, paste:, moveBackward:</string> |
Video: Meet async/await in Swift
With Swift concurrency, functions, initializers, read-only properties, and for-loops can all be marked async
. Property getters can also throw.
func fetchThumbnails() await throws -> [UIImage] {
}
extension UIImage {
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 | |
} | |
} | |
} |
SwiftUI is all about state, and maintaining that state can be rather difficult when you have more than a few properties stored as @State for your view. It is common practice to use a view model to store the state outside of the view, since our views are constantly recreated as our state changes. Keeping what state you want in memory can provide a challenge, much more so than it may seem at first glance.
With SwiftUI 2, using @StateObject will keep a view model from being recreated with each rendering of a view's body. If the parent view is creating the view model, and then passing that down to the child view, that view model will also be recreated with each rendering of that parent view body.
struct ParentView: View {
var body: some View {
ACTION | |
AD_HOC_CODE_SIGNING_ALLOWED | |
ALTERNATE_GROUP | |
ALTERNATE_MODE | |
ALTERNATE_OWNER | |
ALWAYS_SEARCH_USER_PATHS | |
ALWAYS_USE_SEPARATE_HEADERMAPS | |
APPLE_INTERNAL_DEVELOPER_DIR | |
APPLE_INTERNAL_DIR | |
APPLE_INTERNAL_DOCUMENTATION_DIR |
// | |
// ThreadSafe.swift | |
// GDICore | |
// | |
// Created by Grant Davis on 1/2/21. | |
// Updated to support `_modify` accessor on 12/5/21. | |
// | |
// Copyright © 2021 Grant Davis Interactive, LLC. All rights reserved. | |
// | |
import Foundation |