기본 콘텐츠로 건너뛰기

12월, 2021의 게시물 표시

SwiftUI, List with no spacing

    List{                                  HStack(spacing:0){                         Text("xxx")                      Text("xxx")                 }.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))           } Ref :  https://stackoverflow.com/questions/57202421/swiftui-remove-space-between-cells

SwiftUI, use SwiftUI with storyboard

import UIKit import SwiftUI struct SecondView : View { var body: some View { VStack { Text ( "Second View" ).font(.system(size: 36 )) Text ( "Loaded by SecondView" ).font(.system(size: 14 )) } } } class ChildHostingController : UIHostingController < SecondView > { required init? ( coder : NSCoder ) { super . init (coder: coder,rootView: SecondView ()); } override func viewDidLoad () { super .viewDidLoad() } } Ref : https://stackoverflow.com/questions/56529488/is-there-any-way-to-use-storyboard-and-swiftui-in-same-ios-xcode-project Reif2 (Korean) https://mildwhale.tistory.com/37

SwiftUI, Calendar Library, GridDate, Test

  import SwiftUI import DateGrid struct ContentView : View {               @State var selectedMonthDate = Date ()     @State var mode = CalenderMode . month ( estimateHeight : 500 )          let dateInterval = DateInterval . init ( start : Date . getDate ( from : "2021 01 01" )!, end : Date . getDate ( from : "2021 12 11" )!)          let screen = UIScreen . main . bounds          init (){                  var dateComponents = DateComponents ()         dateComponents. year = 2021         dateComponents. month = 12         dateComponents. day = 11         let userCalendar = Calendar ( identifier : . gregorian ) // since the components above (like year 1980) are for Gregorian         let someDateTime = userCalendar. date ( from : dateComponents)                           //doen't work...         selectedMonthDate = someDateTime!                       }          var body : some View {                  ZStack {             VStack {           

SwiftUI, extension sample

  struct HiddenNavigationBar : ViewModifier { func body ( content : Content ) -> some View { content .navigationBarTitle( "" , displayMode: .inline) .navigationBarHidden( true ) } } extension View { func hiddenNavigationBarStyle () -> some View { modifier( HiddenNavigationBar () ) } } ---------------------------------------------------------- .hiddenNavigationBarStyle() REF : https://www.hackingwithswift.com/forums/swiftui/removing-unwanted-and-unknown-whitespace-possibly-a-navigation-bar-above-a-view/7343

SwiftUI, NavigationView, remove top space

      NavigationView {             List{                 ...                }             }             .navigationBarTitle("")             .navigationBarHidden( true )             .navigationBarBackButtonHidden( true )         }   not NavigationView in NavigationView!  Ref :  https://www.hackingwithswift.com/forums/swiftui/removing-unwanted-and-unknown-whitespace-possibly-a-navigation-bar-above-a-view/7343