From 49d6db915867993ea98e2a0699131f2dbbfa8fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=CC=81ngel=20Di=CC=81az?= Date: Wed, 27 Nov 2019 18:08:33 +0100 Subject: [PATCH] minor changes --- .../NefSwiftPlayground/Utils/IO+Console.swift | 2 +- .../NefSwiftPlayground/Utils/String+Utils.swift | 12 ++++++++++++ project/nef.xcodeproj/project.pbxproj | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 project/Component/NefSwiftPlayground/Utils/String+Utils.swift diff --git a/project/Component/NefSwiftPlayground/Utils/IO+Console.swift b/project/Component/NefSwiftPlayground/Utils/IO+Console.swift index 73b6d9ad..0a98df64 100644 --- a/project/Component/NefSwiftPlayground/Utils/IO+Console.swift +++ b/project/Component/NefSwiftPlayground/Utils/IO+Console.swift @@ -18,7 +18,7 @@ extension IO where E == SwiftPlaygroundError { let substepIO: IO if verbose, let string = (value as? CustomStringConvertible)?.description, !string.isEmpty { - let information = string.replacingOccurrences(of: "[", with: "").replacingOccurrences(of: "]", with: "").replacingOccurrences(of: "\"", with: "") + let information = string.clean("[", "]", "\"") .components(separatedBy: ", ") .map { $0.filename } .sorted(by: { $0.lowercased() < $1.lowercased() }) diff --git a/project/Component/NefSwiftPlayground/Utils/String+Utils.swift b/project/Component/NefSwiftPlayground/Utils/String+Utils.swift new file mode 100644 index 00000000..b9edf0a9 --- /dev/null +++ b/project/Component/NefSwiftPlayground/Utils/String+Utils.swift @@ -0,0 +1,12 @@ +// Copyright © 2019 The nef Authors. + +import Foundation + +extension String { + + func clean(_ ocurrences: String...) -> String { + return ocurrences.reduce(self) { (output, ocurrence) in + output.replacingOccurrences(of: ocurrence, with: "") + } + } +} diff --git a/project/nef.xcodeproj/project.pbxproj b/project/nef.xcodeproj/project.pbxproj index 437749a0..3bb3e57b 100644 --- a/project/nef.xcodeproj/project.pbxproj +++ b/project/nef.xcodeproj/project.pbxproj @@ -66,6 +66,7 @@ 8B46C422238EBD9300437659 /* PlaygroundExcludeItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B46C420238EBC7400437659 /* PlaygroundExcludeItem.swift */; }; 8B46C426238EC0A100437659 /* BowOptics in Frameworks */ = {isa = PBXBuildFile; productRef = 8B46C425238EC0A100437659 /* BowOptics */; }; 8B46C428238ED11000437659 /* Optics+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B46C427238ED11000437659 /* Optics+Utils.swift */; }; + 8B46C42A238EE4C400437659 /* String+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B46C429238EE4C400437659 /* String+Utils.swift */; }; 8B603EA7237A3CFE0059C9C7 /* nef.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B603E9F237A3CFE0059C9C7 /* nef.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8B6B119D22CB9FDE0060177F /* NefCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B6B119422CB9FDE0060177F /* NefCore.framework */; }; 8B75AF9123805A5200388B1C /* CarbonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B75AF9023805A5200388B1C /* CarbonView.swift */; }; @@ -312,6 +313,7 @@ 8B46C41C238D917D00437659 /* PlaygroundBookTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaygroundBookTemplate.swift; sourceTree = ""; }; 8B46C420238EBC7400437659 /* PlaygroundExcludeItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaygroundExcludeItem.swift; sourceTree = ""; }; 8B46C427238ED11000437659 /* Optics+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optics+Utils.swift"; sourceTree = ""; }; + 8B46C429238EE4C400437659 /* String+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Utils.swift"; sourceTree = ""; }; 8B4F45A522CF9AF400E6F471 /* NefModels.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NefModels.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8B603E9F237A3CFE0059C9C7 /* nef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nef.h; sourceTree = ""; }; 8B646F94237D71C50009AB43 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; @@ -790,6 +792,7 @@ 8BD6F70C238C495600DD93C4 /* IO+Console.swift */, 8BD6F709238C278D00DD93C4 /* String+Path.swift */, 8B46C427238ED11000437659 /* Optics+Utils.swift */, + 8B46C429238EE4C400437659 /* String+Utils.swift */, ); path = Utils; sourceTree = ""; @@ -1329,6 +1332,7 @@ 8BD6F703238C256700DD93C4 /* FileSystemError.swift in Sources */, 8B46C40E238D75A400437659 /* Package.swift in Sources */, 8B46C41B238D8A0000437659 /* PlaygroundBookResolvePath.swift in Sources */, + 8B46C42A238EE4C400437659 /* String+Utils.swift in Sources */, 8BD6F700238C253700DD93C4 /* FileSystem.swift in Sources */, 8BD4E33123881946002DECDB /* SwiftPlayground.swift in Sources */, 8BD4E33723881F9F002DECDB /* PlaygroundResolvePath.swift in Sources */,