기본 콘텐츠로 건너뛰기

2022의 게시물 표시

Vue, iOS, 연계

 Vue -> iOS에 URL Hook대상의 URL이 감지되지 않는 문제. Vue에서 window.open으로 처리 -> 첫번째는 네이티브에서 감지가 되었지만 두번째부터 안됨 WebView의 블록문제일지도 window.open -> href.location으로 바꾼후 정상적으로 작동

iOS, Test Flight

 ・AppStore Connector ①appstoreでアプリ生成 ・XCode ① bundle name : 大文字なし ②app icon 登録 ④Xcode > Archive > Distribution > AppStore update  ・AppStore Connector ①AppからTestFlight ②テスター追加(招待) ③ビルド選択 ・Tester ①iPhoneでTestFlightアプリを設置 ②メールで招待メールからLinkをタップ ③TestFlightで招待をOK ④アプリインストール

SwiftUI, View visibility

  extension View {   @ViewBuilder func visibility ( _ isShow: Bool ) -> some View {     if isShow {         self     } else {              }   } extension View {   @ViewBuilder func visibility ( _ isShow: Bool ) -> some View {     if isShow {         self     } else {         hidden ()     }   } } https://swiftuirecipes.com/blog/how-to-hide-a-swiftui-view-visible-invisible-gone

SwiftUI, iOS14, hide Keyboard

       @State private var isKeyboardVisible = false if isKeyboardVisible {                     Button {                          hideKeyboard ()                      } label : {                         Color . clear . edgesIgnoringSafeArea (. all )                     }                 }                  . onReceive ( keyboardPublisher ) { newIsKeyboardVisible in                     print( "Is keyboard visible? " , newIsKeyboardVisible)                     isKeyboardVisible = newIsKeyboardVisible                 } import Foundation import SwiftUI import Combine extension UIApplication {     func endEditing () {         sendAction ( #selector ( UIResponder . resignFirstResponder ), to : nil , from : nil , for : nil )     } } protocol KeyboardReadable {     var keyboardPublisher : AnyPublisher < Bool , Never > { get } } extension KeyboardReadable {     var keyboardPublisher : AnyPublisher < Bool , Never > {         Publishers . Merge (          

SwiftUI, Floating TextField implement

  FloatingField ( "title" , text : $statevar )                                 . textFieldStyle ( RoundedBorderTextFieldStyle ())                                 . keyboardType (. asciiCapable ) struct FloatingField : View {     @Binding private var text : String     private var title : String          init ( _ title: String , text : Binding < String >) {         self . title = title         self ._text = text     }          var body : some View {         ZStack {             HStack {                 TextField ( title , text : $text )                     . textFieldStyle ( RoundedBorderTextFieldStyle ())             }                          if ! text . isEmpty {                 HStack {                     Text ( title )                         . font (. caption )                         . background (. white )                                              Spacer ()                 }. offset ( x : 7 , y : - 17 )                              }         }

SwiftUI, TextField, 入力制限、英数字

  英数字のみ TextField ( "Input" , text : $input ) . onChange ( of : input , perform : filter ) func filter ( value : String ) {         let validCodes = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"         let sets = CharacterSet ( charactersIn : validCodes)          input  = String (value. unicodeScalars . filter (sets. contains ). map ( Character . init ))                  if 10 < input . count {             input = String ( input . prefix ( 10 ))         }     } https://zenn.dev/yorifuji/articles/swiftui-textfield-filter

SwiftUI, half modal

 https://zenn.dev/oka_yuuji/articles/6b5d8ca2917707      @State var show = false     @State var showFull = false     @State var position = CGSize . zero     @State var viewSize = UIScreen . main . bounds     @State var higthRate = 0.35                ZStack {                 Rectangle ()                     . foregroundColor (. yellow )                 VStack {                     RoundedRectangle ( cornerRadius : 10 )                         . frame ( width : 60 , height : 5 )                         . padding (. top )                     Spacer ()                 }             }             . cornerRadius ( 20 )             . offset ( y : show ? viewSize . height * 0.4 : viewSize . height )             . offset ( y : position . height )             . animation (. timingCurve ( 0.2 , 0.8 , 0.2 , 1 , duration : 0.9 ), value : show ) +背景 if ( showModal ) {                                                  Button {                             showModal  = false      

SwiftUI, TextEditor placeholder

  ZStack {                                 VStack {                                     Text ( "PlaceHolder" )                                         . foregroundColor ( .gray )                                         . frame ( maxWidth : . infinity , alignment : . topLeading )                                         . padding (. top , 10 ). padding (. leading , 10 )                                                                      Spacer ()                                                                  }                             TextEditor ( text : $txt )                                 . frame ( maxWidth : . infinity , maxHeight : 80 )                                 . frame ( height : 60 )                                 . padding (. horizontal , 5.0 )                                 . opacity ( txt . isEmpty ? 0.25 : 1 )                             }                             . overlay ( RoundedRectangle ( cornerRadius : 5.0 )                              

SwiftUI, UT, ViewInspector

*** ViewInspector https://github.com/nalexn/ViewInspector/blob/master/guide.md *** import Lib https://www.raywenderlich.com/30227776-swiftui-testing-with-viewinspector-for-ios *** build error after lib import https://developer.apple.com/forums/thread/676682 ->  Creating a brand new test target fixed this.

SwiftUI, circle button

                                      Button ( action :{                                              }){                         Text ( "?" )                             . frame ( width : 30 , height : 30 )                             . background ( Color ( Const . BTN_COLOR ))                             . font (. title ). foregroundColor (. white ). clipShape ( Circle ())                                              }                     . buttonStyle ( PlainButtonStyle ())