Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
メタプログラミング向けのテンプレートエンジン gysb を作った
Search
omochimetaru
November 21, 2017
Programming
3
590
メタプログラミング向けのテンプレートエンジン gysb を作った
2017/11/21 関西モバイルアプリ研究会 in 関東
https://kanmoba.connpass.com/event/70685/
omochimetaru
November 21, 2017
Tweet
Share
More Decks by omochimetaru
See All by omochimetaru
型推論のちょっと深い話
omochi
1
500
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
4
9.6k
[スクリプト] Swiftの型推論を学ぼう
omochi
2
450
Swift6のprotocol
omochi
6
1.3k
SwiftSyntaxをうまく使おう
omochi
2
370
今から使えるSwiftとC++の新しいinterop手法
omochi
0
470
CSFixとラベルマッチ
omochi
0
420
Swiftのmodifyアクセサとコルーチン
omochi
0
830
Swiftのオーバーロード選択のスコア規則12種類
omochi
3
440
Other Decks in Programming
See All in Programming
基礎から学ぶ大画面対応(Learning Large-Screen Support from the Ground Up)
tomoya0x00
0
1.5k
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
230
1から理解するWeb Push
dora1998
7
1.9k
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
330
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
150
概念モデル→論理モデルで気をつけていること
sunnyone
2
230
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
テストカバレッジ100%を10年続けて得られた学びと品質
mottyzzz
2
600
Kiroで始めるAI-DLC
kaonash
2
590
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
2
760
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Practical Orchestrator
shlominoach
190
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
Thoughts on Productivity
jonyablonski
70
4.8k
Music & Morning Musume
bryan
46
6.8k
Being A Developer After 40
akosma
90
590k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Transcript
ϝλϓϩάϥϛϯά͚ ͷςϯϓϨʔτΤϯδϯ gysb Λ࡞ͬͨ omochimetaru @
Array ͱ ؒͨͪ Array - startIndex, endIndex, subscript, _ArrayBuffer ArraySlice
- startIndex, endIndex, subscript, _SliceBuffer ContiguousArray - startIndex, endIndex, subscript, _ContiguousArrayBuffer
gyb Generate Your Boilerplate
gyb Generate Your Boilerplate ࣮ߦ: %{ <python code> }% ࣮ߦ:
% <python code> (ߦ) ࣜల։: ${ <python code> }
Arrays.swift.gyb apple/swift @ github
%{ arrayTypes = [ ('ContiguousArray', 'a `ContiguousArray` instance'), ('ArraySlice', 'an
`ArraySlice` instance'), ('Array', 'an array'), ] }% % for (Self, a_Self) in arrayTypes: public struct ${Self}<Element> { %if Self == 'Array': internal typealias _Buffer = _ArrayBuffer<Element> %elif Self == 'ArraySlice': internal typealias _Buffer = _SliceBuffer<Element> %else: internal typealias _Buffer = _${Self.strip('_')}Buffer<Element> %end internal var _buffer: _Buffer } %end
public struct ContiguousArray<Element> { internal typealias _Buffer = _ContiguousBuffer<Element> internal
var _buffer: _Buffer } public struct ArraySlice<Element> { internal typealias _Buffer = _SliceBuffer<Element> internal var _buffer: _Buffer } public struct Array<Element> { internal typealias _Buffer = _ArrayBuffer<Element> internal var _buffer: _Buffer }
gyb ͷྑ͘ͳ͍ͱ͜Ζ
gyb ͷྑ͘ͳ͍ͱ͜Ζ python Λॻ͘ͱ͜Ζ
gysb Generate Your Swifty Boilerplate
gysb Generate Your Swifty Boilerplate https://github.com/omochi/gysb ࣮ߦ: %{ <swift code>
}% ࣮ߦ: % <swift code> (ߦ) ࣜల։: ${ <swift code> }
Demo ࣮ࡍͷσϞͷͱ͖ɺ ҎԼͷιʔεΛࡐʹɺ --source-dirs, --parse, --compile Ϟʔυͷಈ࡞Λհ͠ ͨɻ https://github.com/omochi/ReactiveEmitter/blob/master/ Sources/ReactiveEmitter/Operator/Combine.swift.gysb
gysb ͷ։ൃ gysb ͷಈ࡞ݪཧͦΕࣗମϝλϓϩάϥϛϯά͔ͩΒ Swift ͷϝλϓϩάϥϛϯά͢ΔͨΊʹ Swift ͷϝλϓϩάϥϛϯάΛߦ͏ Swift ϓϩάϥϜΛ࡞ͬͨ
! (͋ͱ Kotlin C++ ੜͰ͖ΔΑ)
(એ) Discord Offline Discord αʔό ios-developers-japan ΛϦΞϧͰ 12/4 ϝϧΧϦ ύωϧσΟεΧογϣϯܗࣜ
https://connpass.com/event/71774/
Sourceryͱͷҧ͍ Sourcery ܕใऔಘ + ςϯϓϨʔτ(ෳݴޠ) gysb ςϯϓϨʔτ Sourcery
ͷ swift ςϯϓϨʔτϥΠϒϥϦඇରԠ gysb gysb.json Ͱ SwiftPM ʹରԠ