| Pure Inference | Rules-Augmented Inference | |
|---|---|---|
| Time-to-first-output | Fast | Slow at first |
| Output variance | High — every run produces a different design | Low — designs converge to the rules |
| Team-wide reproducibility & scalability | None — best prompter wins; results don't generalize | Yes — sharpen the rules, lift everyone's output |
| Review burden | Heavy — review at the design level | Light — just check rule conformance |
| Stability across model switches | Fragile — re-tune prompts | Stable — rules outlive models |
| import Foundation | |
| @_functionBuilder | |
| struct ContentListBuilder { | |
| static func buildBlock() -> ContentList { | |
| return EmptyContentList() | |
| } | |
| static func buildBlock(_ list: ContentList) -> ContentList { |
こんにちは。iOSエンジニアの@kitasukeです。
今回は、Swift Compilerのパーサー内部でlibSyntaxが作成する、StringLiteralExprに関する改善を行ったので、その内容を簡単に紹介します。
ちなみに、この変更はlibSyntax内での変更でありSwiftのString APIへの変更ではありません。
libSyntaxには、Stringリテラル用にStringLiteralExprとStringInterpolationExprの2種類のシンタックスが定義されています。
| sil_stage canonical | |
| import Builtin | |
| import Swift | |
| import SwiftShims | |
| // main | |
| sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
| bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
| %2 = integer_literal $Builtin.Int32, 0 // user: %3 |
| sil_stage canonical | |
| import Builtin | |
| import Swift | |
| import SwiftShims | |
| // main | |
| sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { | |
| bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): | |
| %2 = integer_literal $Builtin.Int32, 0 // user: %3 |
| import Foundation | |
| import RxSwift | |
| import FBSDKCoreKit | |
| import FBSDKLoginKit | |
| enum FacebookSDKError: Error { | |
| case tokenNotFound | |
| } | |
| extension Reactive where Base: FBSDKLoginManager { |
| import UIKit | |
| import RxSwift | |
| import RxCocoa | |
| extension Reactive where Base: UITableView { | |
| func items<S: Sequence, Cell: UITableViewCell, O: ObservableType> | |
| (cellType: Cell.Type) | |
| -> (_ source: O) | |
| -> (_ configureCell: @escaping (Int, S.Iterator.Element, Cell) -> Void) | |
| -> Disposable |
Apple recently open sourced swift-protobuf which is a plugin of Protocol Buffers for swift language. Protocol Buffers in Swift enables us to have type safety, make API faster and unify schema documentation of structured data. I had a chance to use swift-protobuf in my project and thought that there are many benefits for us, so I would like to share my thoughts.
I also created a repository which has sample server/client app with Protocol Buffers. Please take a look here if you're interested in what implementation looks like.
| import Foundation | |
| import APIKit | |
| protocol ProtobufRequest: Request {} | |
| extension ProtobufRequest { | |
| var dataParser: DataParser { | |
| return ProtobufDataParser() | |
| } | |
| } |