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 AssertNoThrow<T>(_ expression: @autoclosure () throws -> T, file: StaticString = #file, line: UInt = #line) rethrows -> T { | |
do { | |
return try expression() | |
} catch { | |
XCTFail("\(error)", file: file, line: line) | |
throw error | |
} | |
} | |
func returnSomethingOrThrow() throws -> Int { ... } |
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
#!/usr/bin/env ruby | |
# Usage: | |
# chmod 755 create_xcode_snippets.rb | |
# ./create_xcode_snippets.rb --project_path "path-to-project-file.xcodeproj" | |
require 'xcodeproj' | |
$project_path = File.expand_path(ARGV.find.with_index { |item, index| ARGV[index - 1] == "--project_path" }) | |
$snippets_path = File.expand_path("~/Library/Developer/Xcode/UserData/CodeSnippets/") | |
$snippet_prefix = "STEP-" |
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 stringify(@StringBuilder _ value: () -> Stringified) { | |
print(value().value) | |
} | |
struct Stringified { | |
let value: String | |
init(_ value: String) { | |
self.value = "stringified " + value | |
} | |
} |
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 Foundation | |
public struct Unit: Codable, Equatable { | |
init() {} | |
public init(from decoder: Decoder) {} | |
public func encode(to encoder: Encoder) throws {} | |
public static func ==(lhs: Self, rhs: Self) -> Bool { | |
return true | |
} | |
} |
OlderNewer