Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SwiftUIで出てきたGeometryReaderって何?

h.crane
July 31, 2019

 SwiftUIで出てきたGeometryReaderって何?

h.crane

July 31, 2019
Tweet

More Decks by h.crane

Other Decks in Technology

Transcript

  1. About me 〈Company〉 - every, inc. / DELISH KITCHEN 〈Role〉

    - iOS Developer 〈Account〉 - Twitter: @hcrane14 - Qiita: H_Crane
  2. Views and Layouts 1.Views and Controls Text, TextField, SecureField, Font,

    Image, Button, NavigationLink, MenuButton, EditButton, PasteButton, Toggle, Picker, DatePicker, Slider, Stepper, SegmentedControl
  3. Views and Layouts 1.Views and Controls 2.View Layout and Presentation

    Text, TextField, SecureField, Font, Image, Button, NavigationLink, MenuButton, EditButton, PasteButton, Toggle, Picker, DatePicker, Slider, Stepper, SegmentedControl HStack, VStack, ZStack, List, ForEach, ScrollView, Form, Group, GroupBox, Section,Spacer, Divider, NavigationView, TappedView, HSplitView, VSplitView, Alert, ActionSheet, EmptyView, EquatableView, AnyView, TuppleView
  4. Views and Layouts 1.Views and Controls 2.View Layout and Presentation

    Text, TextField, SecureField, Font, Image, Button, NavigationLink, MenuButton, EditButton, PasteButton, Toggle, Picker, DatePicker, Slider, Stepper, SegmentedControl HStack, VStack, ZStack, List, ForEach, ScrollView, Form, Group, GroupBox, Section,Spacer, Divider, NavigationView, TappedView, HSplitView, VSplitView, Alert, ActionSheet, EmptyView, EquatableView, AnyView, TuppleView → 名前から何となく想像がつく  ➡ UIKitにも似たようなのあったな
  5. About GeometryReader A container view that defines its content as

    a function of its own size and coordinate space. Overview:This view returns a flexible preferred size to its parent layout. @frozen struct GeometryReader<Content> where Content : View
  6. About GeometryReader A container view that defines its content as

    a function of its own size and coordinate space. Overview:This view returns a flexible preferred size to its parent layout. コンテンツ自身のサイズと座標空間を定義している 概要:適切なサイズを親のレイアウトに返す @frozen struct GeometryReader<Content> where Content : View
  7. Example 1. Size *Quote of screenshot is Sketch *Quote of

    screenshot is Qiita geometry.size.height geometry.size.width
  8. Example 2. Coordinate geometry.size.height geometry.size.width *Quote of screenshot is Qiita

    ① geometry.frame(in: .global) ② geometry.frame(in: .local) *Quote of screenshot is Qiita ① ② UIView / frame UIView / bounds
  9. Example 3. Animation *Quote of screenshot is Sketch *Quote of

    screenshot is Qiita 引用: チュートリアルから一歩踏み出したSwiftUIのCustom Viewの作り方ーその 1https://qiita.com/takaf51/items/a67db8bbc42a4c82b1f0 ex
  10. To end my presentation GeometryReaderを使うと - 親に対して座標と大きさを取得できる - 画面をリッチにできる ➡

    UIKitでは対応していたものが、なくなっている?ものあるので、 それを補う意味でも、GeometryReaderを使って行くことになりそ う。