carthage bootstrap --no-use-binaries --use-xcframeworks --use-submodules --platform iOS
mkdir Release
cd Carthage/Build
zip -r -X ../../Release/XXX.xcframework.zip XXX.xcframework
shasum -a 256 "XXX.xcframework.zip" >> checksum
cat checksum
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 | |
// MARK: without cancel implementation | |
print("check without cancel implementation") | |
do { | |
print("#1 function") | |
func function() async -> Int { | |
return await withTaskCancellationHandler { |
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 | |
class Base: UIViewController { | |
func mySomeAsyncSequence() -> AsyncStream<String> { | |
fatalError() | |
} | |
func use(_ value: String) { | |
print(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
public enum Either<L, R> { | |
case left(L) | |
case right(R) | |
} | |
@resultBuilder | |
public struct Expressive<T> { | |
public static func buildBlock<C>() -> C? { nil } | |
public static func buildBlock<C>(_ component: C) -> C { component } | |
public static func buildEither(first component: T) -> T { component } |
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 | |
private class Weakbox { | |
weak var object: NSObjectProtocol? | |
init(_ object: NSObjectProtocol) { | |
self.object = object | |
} | |
} | |
class DelegateForwarder: NSObject { |
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
// tryがResult.flatMapのdo記法であることの確認。 | |
// 逆になるが、Result.flatMapから考えていったほうが理解しやすいのでその順番で。 | |
func foo() -> Result<Int, Error> { | |
.success(1) | |
} | |
func bar(_ arg: Int) -> Result<Int, Error> { | |
.success(arg + 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
struct Single<T> {} | |
struct Maybe<T> {} | |
protocol MaybeCov { | |
associatedtype T | |
func asMaybe() -> Maybe<T> | |
} | |
extension Single: MaybeCov { | |
func asMaybe() -> Maybe<T> { fatalError() } |
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
public typealias PartialApplySelfToIsEqual = (Any?) -> Bool | |
public protocol MaybeEquatable { | |
func partialApplySelftoIsEqual() -> PartialApplySelfToIsEqual | |
} | |
extension MaybeEquatable { | |
public func partialApplySelftoIsEqual() -> PartialApplySelfToIsEqual { | |
{ _ in false } | |
} | |
} |
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
private struct SwiftFuncWrapper { | |
var trampolinePtr: UnsafeMutablePointer<UInt64> | |
var functionObject: UnsafeMutablePointer<SwiftFuncObject> | |
var functionPtr: UnsafeMutableRawPointer { | |
let pointer = UnsafeMutablePointer<UInt64>(bitPattern: UInt(functionObject.pointee.address))! | |
// Getting actual function ptr from instruction. | |
// 0: 55 push rbp | |
// 1: 48 89 e5 mov rbp,rsp | |
// 4: 5d pop rbp |
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
public struct BundleReference<T: NSObjectProtocol> { | |
static var _bundle: Bundle { | |
return Bundle(for: T.self) | |
} | |
} | |
public protocol BundleReferencable { | |
associatedtype Referenced: NSObjectProtocol | |
static var bundle: BundleReference<Referenced>.Type { get } |
NewerOlder