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
580
メタプログラミング向けのテンプレートエンジン 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
490
Swiftの型推論を学ぼう | Let's Learn About Type Inference in Swift
omochi
4
9.4k
[スクリプト] Swiftの型推論を学ぼう
omochi
2
440
Swift6のprotocol
omochi
6
1.3k
SwiftSyntaxをうまく使おう
omochi
2
360
今から使えるSwiftとC++の新しいinterop手法
omochi
0
460
CSFixとラベルマッチ
omochi
0
420
Swiftのmodifyアクセサとコルーチン
omochi
0
810
Swiftのオーバーロード選択のスコア規則12種類
omochi
3
430
Other Decks in Programming
See All in Programming
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
130
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
730
MDN Web Docs に日本語翻訳でコントリビュートしたくなる
ohmori_yusuke
1
120
猫と暮らす Google Nest Cam生活🐈 / WebRTC with Google Nest Cam
yutailang0119
0
120
Discover Metal 4
rei315
2
140
Deep Dive into ~/.claude/projects
hiragram
14
2.6k
10 Costly Database Performance Mistakes (And How To Fix Them)
andyatkinson
0
340
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
290
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
5.8k
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
680
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
190
A2A プロトコルを試してみる
azukiazusa1
2
1.4k
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
82
9.1k
Optimising Largest Contentful Paint
csswizardry
37
3.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
GitHub's CSS Performance
jonrohan
1031
460k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
KATA
mclloyd
30
14k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Building Applications with DynamoDB
mza
95
6.5k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Why Our Code Smells
bkeepers
PRO
336
57k
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 ʹରԠ