This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------- | |
Translated Report (Full Report Below) | |
------------------------------------- | |
Process: Xcode [4064] | |
Path: /Applications/Xcode.app/Contents/MacOS/Xcode | |
Identifier: com.apple.dt.Xcode | |
Version: 15.4 (22622) | |
Build Info: IDEApplication-22622000000000000~2 (15F31d) | |
App Item ID: 497799835 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum FolderSizeCalculatorError: Error { | |
case urlUnreachableOrNotDirectory | |
case failToEnumerateDirectoryContent | |
case failToGenerateString | |
} | |
class FolderSizeCalculator { | |
private let fileManager: FileManager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
class DummyVC: UIViewController { | |
let margin: CGFloat = 20 | |
override func viewDidLoad() { | |
view.backgroundColor = .green | |
view.addSubview(pipView) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array { | |
func grouped<T: Equatable>(by value: (Element) -> T) -> [[Element]] { | |
var result = [[Element]]() | |
for element in self { | |
var foundIndex: Int? | |
for (index, internalArray) in result.enumerated() { | |
if let firstValue = internalArray.first, value(firstValue) == value(element) { | |
foundIndex = index | |
continue | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PaddingLabel: UILabel { | |
var padding: UIEdgeInsets { | |
didSet { | |
invalidateIntrinsicContentSize() | |
} | |
} | |
public required init(padding: UIEdgeInsets = .zero) { | |
self.padding = padding | |
super.init(frame: CGRect.zero) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
//Set your views and long press recognizer to magnifyControlView | |
private func handleMagnify(_ recognizer: UILongPressGestureRecognizer) { | |
let point = recognizer.location(in: magnifyControlView).multiplyValues(by: controlScale) | |
switch recognizer.state { | |
case .began: | |
magnifyView = MagnifyingView(viewToMagnify: comicPageImageView, size: CGSize(width: 200, height: 200)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MagnifyingView: UIView { | |
private weak var viewToMagnify: UIView! | |
private var touchPoint: CGPoint! | |
var zoomScale: CGFloat = 2 | |
public required init?(coder aDecoder: NSCoder) { fatalError() } | |
public init(viewToMagnify: UIView, size: CGSize) { | |
self.viewToMagnify = viewToMagnify | |
super.init(frame: CGRect(origin: .zero, size: size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func imagePressed(sender: ForceGestureRecognizer) { | |
let point = sender.locationInView(self.view) | |
let imageCoordPoint = CGPointMake(point.x - initialFrame.origin.x, point.y - initialFrame.origin.y) | |
var xValue = max(0, imageCoordPoint.x / initialFrame.size.width) | |
var yValue = max(0, imageCoordPoint.y / initialFrame.size.height) | |
xValue = min(xValue, 1) | |
yValue = min(yValue, 1) | |
NewerOlder