From 5ec31bbf541056e02ec2dd0a94792425ebab1201 Mon Sep 17 00:00:00 2001 From: Akylbek Utekeshev Date: Wed, 18 Oct 2023 10:14:29 +0600 Subject: [PATCH] MBX-2864 Remove unused code --- Mindbox.xcodeproj/project.pbxproj | 4 -- .../NSManagedObjectContext+Extension.swift | 45 ------------------- 2 files changed, 49 deletions(-) delete mode 100644 MindboxLogger/Shared/Extensions/NSManagedObjectContext+Extension.swift diff --git a/Mindbox.xcodeproj/project.pbxproj b/Mindbox.xcodeproj/project.pbxproj index 369e0e96..94bd5bc3 100644 --- a/Mindbox.xcodeproj/project.pbxproj +++ b/Mindbox.xcodeproj/project.pbxproj @@ -242,7 +242,6 @@ A17853D829AF7ED90072578F /* LogWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E33B299E5B6D00F8F074 /* LogWriter.swift */; }; A17853D929AF7ED90072578F /* LogMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E33D299E5B6D00F8F074 /* LogMessage.swift */; }; A17853DA29AF7ED90072578F /* LogLevel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E33A299E5B6D00F8F074 /* LogLevel.swift */; }; - A17853DB29AF7EDE0072578F /* NSManagedObjectContext+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E33F299E5B6D00F8F074 /* NSManagedObjectContext+Extension.swift */; }; A17853DC29AF7EDE0072578F /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E341299E5B6D00F8F074 /* String+Extensions.swift */; }; A17853DD29AF7EDE0072578F /* Date+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E340299E5B6D00F8F074 /* Date+Extension.swift */; }; A17853DE29AF7EDE0072578F /* FileManager+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A154E342299E5B6D00F8F074 /* FileManager+Extensions.swift */; }; @@ -717,7 +716,6 @@ A154E33B299E5B6D00F8F074 /* LogWriter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogWriter.swift; sourceTree = ""; }; A154E33C299E5B6D00F8F074 /* LogCategory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogCategory.swift; sourceTree = ""; }; A154E33D299E5B6D00F8F074 /* LogMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LogMessage.swift; sourceTree = ""; }; - A154E33F299E5B6D00F8F074 /* NSManagedObjectContext+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Extension.swift"; sourceTree = ""; }; A154E340299E5B6D00F8F074 /* Date+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Date+Extension.swift"; sourceTree = ""; }; A154E341299E5B6D00F8F074 /* String+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = ""; }; A154E342299E5B6D00F8F074 /* FileManager+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FileManager+Extensions.swift"; sourceTree = ""; }; @@ -1804,7 +1802,6 @@ A154E33E299E5B6D00F8F074 /* Extensions */ = { isa = PBXGroup; children = ( - A154E33F299E5B6D00F8F074 /* NSManagedObjectContext+Extension.swift */, A154E340299E5B6D00F8F074 /* Date+Extension.swift */, A154E341299E5B6D00F8F074 /* String+Extensions.swift */, A154E342299E5B6D00F8F074 /* FileManager+Extensions.swift */, @@ -3268,7 +3265,6 @@ F3B2A39F2A4C79E200E2CA25 /* UnknownDecodable.swift in Sources */, A17853EB29AF7EF30072578F /* MBPersistentContainer.swift in Sources */, A17853D829AF7ED90072578F /* LogWriter.swift in Sources */, - A17853DB29AF7EDE0072578F /* NSManagedObjectContext+Extension.swift in Sources */, F3B2A3A22A4C79E200E2CA25 /* ProtocolError.swift in Sources */, A15D704729AF81DC007131E7 /* MBLoggerCoreDataManager.swift in Sources */, F3B2A3A12A4C79E200E2CA25 /* MindboxError.swift in Sources */, diff --git a/MindboxLogger/Shared/Extensions/NSManagedObjectContext+Extension.swift b/MindboxLogger/Shared/Extensions/NSManagedObjectContext+Extension.swift deleted file mode 100644 index ac897371..00000000 --- a/MindboxLogger/Shared/Extensions/NSManagedObjectContext+Extension.swift +++ /dev/null @@ -1,45 +0,0 @@ -// -// Extension.swift -// MindboxLogger -// -// Created by Akylbek Utekeshev on 06.02.2023. -// Copyright © 2023 Mikhail Barilov. All rights reserved. -// - -import Foundation -import CoreData - -public extension NSManagedObjectContext { - func performAndWait(_ block: () throws -> T) rethrows -> T { - return try _performAndWaitHelper( - fn: performAndWait, execute: block, rescue: { throw $0 } - ) - } - - /// Helper function for convincing the type checker that - /// the rethrows invariant holds for performAndWait. - /// - /// Source: https://github.com/apple/swift/blob/bb157a070ec6534e4b534456d208b03adc07704b/stdlib/public/SDK/Dispatch/Queue.swift#L228-L249 - private func _performAndWaitHelper( - fn: (() -> Void) -> Void, - execute work: () throws -> T, - rescue: ((Error) throws -> (T))) rethrows -> T - { - var result: T? - var error: Error? - withoutActuallyEscaping(work) { _work in - fn { - do { - result = try _work() - } catch let e { - error = e - } - } - } - if let e = error { - return try rescue(e) - } else { - return result! - } - } -}