Objective-C implementations in Swift
- Proposal: SE-NNNN
- Authors: Becca Royal-Gordon
- Review Manager: TBD
- Status: Awaiting implementation
- Implementation: Preliminary underscored version in main
-Xfrontend -enable-cross-import-overlays
/// Passes a pointer to an uninitialized instance of `type` to `body`. | |
/// If `body` returns `true`, indicating that the memory has now been | |
/// initialized, returns the instance; otherwise returns `nil`. | |
@usableFromInline func withUninitialized<T>( | |
_ type: T.Type, do body: (UnsafeMutablePointer<T>) -> Bool | |
) -> T? { | |
let ptr = UnsafeMutablePointer<T>.allocate(capacity: 1) | |
defer { ptr.deallocate() } | |
guard body(ptr) else { |
struct _AppendingStringInterpolation<Result: ExpressibleByStringInterpolation> { | |
var result: Result | |
} | |
protocol ExpressibleByAppendingStringInterpolation: ExpressibleByStringInterpolation where StringInterpolation == _AppendingStringInterpolation<Self> { | |
init(stringLiteral: String) | |
mutating func append(_ value: Self) | |
} | |
extension ExpressibleByAppendingStringInterpolation where StringInterpolation == _AppendingStringInterpolation<Self> { |
// | |
// UserDefaults+Codable.swift | |
// Converter UltraLight | |
// | |
// Created by Brent Royal-Gordon on 8/31/17. | |
// Copyright © 2017 Architechies. All rights reserved. | |
// MIT-licensed, go nuts with it. | |
// | |
import Foundation |
// | |
// UICollectionViewLayout+indexPaths.swift | |
// Converter Calc | |
// | |
// Created by Brent Royal-Gordon on 7/26/17. | |
// Copyright © 2017 Architechies. All rights reserved. | |
// | |
import UIKit |
import Foundation | |
import ExplicitlyConvertible | |
let i8: Int8 = 8 | |
let i64: Int64 = 64 | |
i64 + ^i8 // => 72 | |
struct Person { | |
var name: String |
// First, let's test out the basic design. This is basically just an | |
// HList. | |
// This recurses to the right because that makes subscripting simpler, | |
// at the cost of making appending impossible to generalize. | |
public protocol TupleProtocol: RandomAccessCollection | |
where Index == Int, IndexDistance == Int, Element == Any | |
{ | |
associatedtype First | |
associatedtype Rest //: TupleProtocol |