Files
AzooKeyKanaKanjiConverter/Sources/SwiftUtils/WithMutableValue.swift
2024-03-30 02:01:11 +09:00

19 lines
526 B
Swift

//
// WithMutableValue.swift
// azooKey
//
// Created by ensan on 2022/10/10.
// Copyright © 2022 ensan. All rights reserved.
//
import Foundation
/// Modifies the given value and returns the result.
/// - Parameters:
/// - value: The value to modify.
/// - process: The process to modify the value.
/// - Note: This function should be used when specific subscript setter is called for multiple times.
@inlinable public func withMutableValue<T>(_ value: inout T, process: (inout T) -> Void) {
process(&value)
}