Skip to content

Commit

Permalink
Replace block with closure for more "swifty" naming
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeichigo committed Sep 27, 2024
1 parent 7856d0a commit f40f843
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Storage/Storage/CoreData/CoreDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ public final class CoreDataManager: StorageManagerType {

/// Handles a write operation using the background context and saves changes when done.
///
public func performAndSave(_ block: @escaping (StorageType) -> Void, completion: (() -> Void)?) {
public func performAndSave(_ closure: @escaping (StorageType) -> Void, completion: (() -> Void)?) {
let derivedStorage = writerDerivedStorage
derivedStorage.perform {
block(derivedStorage)
closure(derivedStorage)
derivedStorage.saveIfNeeded()
completion?()
}
Expand Down
4 changes: 2 additions & 2 deletions Storage/Storage/Protocols/StorageManagerType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public protocol StorageManagerType {

/// Helper method to perform a write operation and save the changes in a background context.
/// - Parameters:
/// - block: the write operation to be handled, given the derived StorageType.
/// - closure: the write operation to be handled, given the derived StorageType.
/// - completion: Callback to be executed on completion
///
func performAndSave(_ block: @escaping (StorageType) -> Void, completion: (() -> Void)?)
func performAndSave(_ closure: @escaping (StorageType) -> Void, completion: (() -> Void)?)

/// This method is expected to destroy all persisted data. A notification of type `StorageManagerDidResetStorage` should get
/// posted.
Expand Down
4 changes: 2 additions & 2 deletions Yosemite/YosemiteTests/Mocks/MockStorageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public class MockStorageManager: StorageManagerType {

/// Handles a write operation using the background context and saves changes when done.
///
public func performAndSave(_ block: @escaping (StorageType) -> Void, completion: (() -> Void)?) {
public func performAndSave(_ closure: @escaping (StorageType) -> Void, completion: (() -> Void)?) {
let derivedStorage = writerDerivedStorage
derivedStorage.perform {
block(derivedStorage)
closure(derivedStorage)
derivedStorage.saveIfNeeded()
completion?()
}
Expand Down

0 comments on commit f40f843

Please sign in to comment.