This file contains 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
// | |
// ViewController.swift | |
// localreporter | |
// | |
// Created by Jeffrey Macko on 15/07/2017. | |
// Copyright © 2017 Jeffrey Macko. All rights reserved. | |
// | |
import UIKit |
This file contains 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 Foundation | |
struct AllocDeallocTester { | |
struct AllocationResult : CustomDebugStringConvertible { | |
let className : String | |
var pointerNumber : Int = 0 | |
var numberOfMissDealloc : Int = 0 | |
var numberOfValidDealloc : Int = 0 |
This file contains 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
#!/usr/bin/env bash | |
# Get the last tag and test | |
swift package diagnose-api-breaking-changes $(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`) |
This file contains 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 Foundation | |
import CustomDump | |
@propertyWrapper | |
public struct Diff<Value: Equatable>: Equatable { | |
public static func == (lhs: Diff<Value>, rhs: Diff<Value>) -> Bool { | |
lhs.value == rhs.value | |
} | |
private var value: Value |
This file contains 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 Foundation | |
extension Bundle { | |
func decode<Output: Decodable>( | |
_ type: Output.Type, | |
filename: String, | |
withExtension ext: String, | |
decoder: any TopLevelDecoder = JSONDecoder() | |
) throw -> Output { | |
guard let fileURL = url(forResource: filename, withExtension: ext) else { |
This file contains 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 Foundation | |
/* | |
print("💾 AddCustomParamsState size: \(bytesFormater(bytes: MemoryLayout<AddCustomParamsState>.size))") | |
*/ | |
public func bytesFormater(bytes: Int) -> String { | |
let bf = ByteCountFormatter() | |
bf.allowedUnits = .useBytes | |
bf.countStyle = .memory |
This file contains 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 Foundation | |
extension RandomAccessCollection { | |
/// Extract duplicates from a RandomAccessCollection | |
/// | |
/// ```swift | |
/// let data = [User("jerem", amount: 567), User("jeff", amount: 124), User("jeff", amount: 567)] | |
/// let duplicateName = data.duplicates(\.name) | |
/// // duplicateName = [User("jeff", amount: 124), User("jeff", amount: 567)] | |
/// let duplicateAmount = data.duplicates(\.amount) |
This file contains 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 Foundation | |
/// This allow to force a default value when using codable | |
/// This will force `isEditMode` to always have `false` when decoding it | |
/// @MockCodable(defaultValue: false) public var isEditMode: Bool = true | |
@propertyWrapper | |
public struct MockCodable<Value> { | |
private var value: Value | |
private var defaultValue: Value | |
This file contains 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 Foundation | |
/// This allow a property to no be encoded | |
@propertyWrapper | |
public struct NotCodable<Boxed> { | |
private var value: Boxed? | |
public init(wrappedValue: Boxed?) { | |
self.value = wrappedValue | |
} |
This file contains 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 CoreFoundation | |
import CoreGraphics | |
import Foundation | |
import SwiftUI | |
public let defaultBadColor = Color.green | |
public let defaultGoodColor = Color.red | |
public struct SerializableCGColorError: Error, LocalizedError { | |
let error: String |
OlderNewer