diff --git a/Modules/RSCore/Sources/RSCore/FileManager+RSCore.swift b/Modules/RSCore/Sources/RSCore/FileManager+RSCore.swift index 0b3673c27..f7d750f26 100644 --- a/Modules/RSCore/Sources/RSCore/FileManager+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/FileManager+RSCore.swift @@ -26,35 +26,6 @@ public extension FileManager { return false } - /// Copies files from one folder to another, overwriting any existing files with the same name. - /// - /// - Parameters: - /// - source: The path of the folder from which to copy files. - /// - destination: The path to the folder at which to place the copied files. - /// - /// - Note: This function does not copy files whose names begin with a period. - func copyFiles(fromFolder source: String, toFolder destination: String) throws { - assert(isFolder(atPath: source)) - assert(isFolder(atPath: destination)) - - let sourceURL = URL(fileURLWithPath: source) - let destinationURL = URL(fileURLWithPath: destination) - - let filenames = try self.contentsOfDirectory(atPath: source) - - for oneFilename in filenames { - if oneFilename.hasPrefix(".") { - continue - } - - let sourceFile = sourceURL.appendingPathComponent(oneFilename) - let destinationFile = destinationURL.appendingPathComponent(oneFilename) - - try copyFile(atPath: sourceFile.path, toPath: destinationFile.path, overwriting: true) - } - - } - /// Retrieve the names of files contained in a folder. /// /// - Parameter folder: The path to the folder whose contents to retrieve. @@ -85,27 +56,4 @@ public extension FileManager { let url = URL(fileURLWithPath: folder) return filenames.map { url.appendingPathComponent($0).path } } - -} - -private extension FileManager { - - /// Copies a single file, possibly overwriting any existing file. - /// - /// - Parameters: - /// - source: The source path. - /// - destination: The destination path. - /// - overwriting: `true` if an existing file at `destination` should be overwritten. - func copyFile(atPath source: String, toPath destination: String, overwriting: Bool) throws { - assert(fileExists(atPath: source)) - - if fileExists(atPath: destination) { - if overwriting { - try removeItem(atPath: destination) - } - } - - try copyItem(atPath: source, toPath: destination) - } - } diff --git a/Modules/RSCore/Sources/RSCore/RSScreen.swift b/Modules/RSCore/Sources/RSCore/RSScreen.swift deleted file mode 100644 index 4fee278db..000000000 --- a/Modules/RSCore/Sources/RSCore/RSScreen.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// RSScreen.swift -// RSCore -// -// Created by Maurice Parker on 4/11/19. -// Copyright © 2019 Ranchero Software. All rights reserved. -// - -#if os(macOS) -import AppKit - -public class RSScreen { - public static var maxScreenScale = CGFloat(2) -} - -#endif - -#if os(iOS) -import UIKit - -public class RSScreen { - public static var maxScreenScale = CGFloat(3) -} - -#endif diff --git a/Modules/RSCore/Sources/RSCore/Set+Extensions.swift b/Modules/RSCore/Sources/RSCore/Set+Extensions.swift index 2efda344b..cb2aabf2f 100755 --- a/Modules/RSCore/Sources/RSCore/Set+Extensions.swift +++ b/Modules/RSCore/Sources/RSCore/Set+Extensions.swift @@ -10,15 +10,6 @@ import Foundation public extension Set { - func anyObjectPassingTest( _ test: (Element) -> Bool) -> Element? { - - guard let index = self.firstIndex(where: test) else { - return nil - } - - return self[index] - } - func anyObject() -> Element? { if self.isEmpty { diff --git a/Modules/RSCore/Sources/RSCore/String+RSCore.swift b/Modules/RSCore/Sources/RSCore/String+RSCore.swift index ed4fc83dd..9ae7c0921 100644 --- a/Modules/RSCore/Sources/RSCore/String+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/String+RSCore.swift @@ -18,10 +18,6 @@ public extension String { return "\(self)" } - func htmlBySurroundingWithTag(_ tag: String) -> String { - return "<\(tag)>\(self)" - } - static func htmlWithLink(_ link: String) -> String { return link.htmlByAddingLink(link) } diff --git a/Shared/Extensions/RSImage-Extensions.swift b/Shared/Extensions/RSImage-Extensions.swift index 0bfdef1f6..88ab72468 100644 --- a/Shared/Extensions/RSImage-Extensions.swift +++ b/Shared/Extensions/RSImage-Extensions.swift @@ -17,12 +17,19 @@ extension RSImage { static let maxIconSize = 48 +#if os(macOS) + static let maxScreenScale = CGFloat(2) +#elseif os(iOS) + static let maxScreenScale = CGFloat(3) +#endif + static func scaledForIcon(_ data: Data, imageResultBlock: @escaping ImageResultBlock) { IconScalerQueue.shared.scaledForIcon(data, imageResultBlock) } static func scaledForIcon(_ data: Data) -> RSImage? { - let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.maxIconSize) * RSScreen.maxScreenScale)) + + let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.maxIconSize) * Self.maxScreenScale)) guard var cgImage = RSImage.scaleImage(data, maxPixelSize: scaledMaxPixelSize) else { return nil }