├── CNAME ├── _config.yml ├── Image ├── Map.png ├── Alert.png ├── Button.png ├── HStack.png ├── List.png ├── Picker.png ├── TabBar.png ├── Text.png ├── Toggle.png ├── VStack.png ├── ZStack.png ├── BarItem.png ├── FormList.png ├── Stepper.png ├── ActionSheet.png ├── ColorPicker.png ├── DatePicker.png ├── FileBrowser.png ├── LocalImage.png ├── LoginForm.png ├── PhotoPicker.png ├── SafariView.png ├── SecureField.png ├── TextEditor.png ├── TextField.png ├── ProgressView.png ├── SFSymbolImage.png ├── social-image.png ├── DisclosureGroup.png ├── NavigationLink.png ├── NavigationView.png ├── PresentedSheet.png ├── SignInWithApple.png └── PreviewController.png ├── SwiftUI-Components-Library ├── Assets.xcassets │ ├── Contents.json │ ├── kitty.imageset │ │ ├── kitty.png │ │ └── Contents.json │ ├── AccentColor.colorset │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Example_Com_PDF.pdf ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── SwiftUI_Components_LibraryApp.swift └── Info.plist ├── assets └── css │ └── style.scss ├── SwiftUI-Components-Library.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── shunzhema.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved ├── xcuserdata │ └── shunzhema.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── Code ├── Text_Example.swift ├── ButtonAction_Example.swift ├── LocalImage_Example.swift ├── Toggle_Example.swift ├── TextEditor_Example.swift ├── SFSymbolImage_Example.swift ├── List_Example.swift ├── TextField_Example.swift ├── ColorPicker_Example.swift ├── DatePicker_Example.swift ├── ForEachList_Example.swift ├── SecureTextField_Example.swift ├── Stepper_Example.swift ├── ZStack_Example.swift ├── HStack_Example.swift ├── Competible │ ├── SafariView_Example.swift │ ├── PhotoPickerController_Example.swift │ ├── MessageCompose_Example.swift │ ├── PreviewController_Example.swift │ ├── EmailCompose_Example.swift │ └── FileBrowser_Example.swift ├── NavigationView_Example.swift ├── Picker_Example.swift ├── DisclosureGroup_Example.swift ├── Alert_Example.swift ├── ProgressView_Example.swift ├── VStack_Example.swift ├── ActionSheet_Example.swift ├── FormList_Example.swift ├── ButtonSheet_Example.swift ├── AlertItems_Example.swift ├── TabView_Example.swift ├── LoginForm_Example.swift ├── ToolBar_Example.swift ├── SignInWithAppleButton_Example.swift ├── ButtonItemSheet_Example.swift ├── Map_Example.swift └── NavigationLink_Example.swift └── README.md /CNAME: -------------------------------------------------------------------------------- 1 | swiftui.mszmagic.com -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /Image/Map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Map.png -------------------------------------------------------------------------------- /Image/Alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Alert.png -------------------------------------------------------------------------------- /Image/Button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Button.png -------------------------------------------------------------------------------- /Image/HStack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/HStack.png -------------------------------------------------------------------------------- /Image/List.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/List.png -------------------------------------------------------------------------------- /Image/Picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Picker.png -------------------------------------------------------------------------------- /Image/TabBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/TabBar.png -------------------------------------------------------------------------------- /Image/Text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Text.png -------------------------------------------------------------------------------- /Image/Toggle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Toggle.png -------------------------------------------------------------------------------- /Image/VStack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/VStack.png -------------------------------------------------------------------------------- /Image/ZStack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/ZStack.png -------------------------------------------------------------------------------- /Image/BarItem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/BarItem.png -------------------------------------------------------------------------------- /Image/FormList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/FormList.png -------------------------------------------------------------------------------- /Image/Stepper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/Stepper.png -------------------------------------------------------------------------------- /Image/ActionSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/ActionSheet.png -------------------------------------------------------------------------------- /Image/ColorPicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/ColorPicker.png -------------------------------------------------------------------------------- /Image/DatePicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/DatePicker.png -------------------------------------------------------------------------------- /Image/FileBrowser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/FileBrowser.png -------------------------------------------------------------------------------- /Image/LocalImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/LocalImage.png -------------------------------------------------------------------------------- /Image/LoginForm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/LoginForm.png -------------------------------------------------------------------------------- /Image/PhotoPicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/PhotoPicker.png -------------------------------------------------------------------------------- /Image/SafariView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/SafariView.png -------------------------------------------------------------------------------- /Image/SecureField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/SecureField.png -------------------------------------------------------------------------------- /Image/TextEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/TextEditor.png -------------------------------------------------------------------------------- /Image/TextField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/TextField.png -------------------------------------------------------------------------------- /Image/ProgressView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/ProgressView.png -------------------------------------------------------------------------------- /Image/SFSymbolImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/SFSymbolImage.png -------------------------------------------------------------------------------- /Image/social-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/social-image.png -------------------------------------------------------------------------------- /Image/DisclosureGroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/DisclosureGroup.png -------------------------------------------------------------------------------- /Image/NavigationLink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/NavigationLink.png -------------------------------------------------------------------------------- /Image/NavigationView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/NavigationView.png -------------------------------------------------------------------------------- /Image/PresentedSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/PresentedSheet.png -------------------------------------------------------------------------------- /Image/SignInWithApple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/SignInWithApple.png -------------------------------------------------------------------------------- /Image/PreviewController.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/Image/PreviewController.png -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Example_Com_PDF.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/SwiftUI-Components-Library/Example_Com_PDF.pdf -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /assets/css/style.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | @import "{{ site.theme }}"; 5 | 6 | footer { 7 | display: none !important; 8 | } 9 | 10 | .btn { 11 | display: none !important; 12 | } 13 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Assets.xcassets/kitty.imageset/kitty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/SwiftUI-Components-Library/Assets.xcassets/kitty.imageset/kitty.png -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/xcuserdata/shunzhema.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/project.xcworkspace/xcuserdata/shunzhema.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mszmagic/SwiftUI-Components-Library/HEAD/SwiftUI-Components-Library.xcodeproj/project.xcworkspace/xcuserdata/shunzhema.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/SwiftUI_Components_LibraryApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUI_Components_LibraryApp.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct SwiftUI_Components_LibraryApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | Stepper_Example() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Assets.xcassets/kitty.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "kitty.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Code/Text_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Text_Example.swift 3 | // SwiftUI_Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Text_Example: View { 11 | var body: some View { 12 | Text("Hello, World!") 13 | .font(.title) 14 | } 15 | } 16 | 17 | struct Text_Example_Previews: PreviewProvider { 18 | static var previews: some View { 19 | Text_Example() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "pins": [ 4 | { 5 | "package": "SwiftUICompatible", 6 | "repositoryURL": "https://github.com/mszmagic/SwiftUICompatible.git", 7 | "state": { 8 | "branch": null, 9 | "revision": "4159ae36966b65d2e2808b710bfcd70c7d12f88a", 10 | "version": "1.0.6" 11 | } 12 | } 13 | ] 14 | }, 15 | "version": 1 16 | } 17 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/xcuserdata/shunzhema.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftUI-Components-Library.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Code/ButtonAction_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonAction_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ButtonAction_Example: View { 11 | 12 | var body: some View { 13 | 14 | Button("クリックしてXcodeのコンソールにログを出力。") { 15 | print("クリック") 16 | } 17 | 18 | } 19 | 20 | } 21 | 22 | struct ButtonAction_Example_Previews: PreviewProvider { 23 | static var previews: some View { 24 | ButtonAction_Example() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Code/LocalImage_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LocalImage_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LocalImage_Example: View { 11 | 12 | var body: some View { 13 | 14 | Image("kitty") 15 | .resizable() 16 | .frame(width: 100, height: 100) 17 | 18 | } 19 | 20 | } 21 | 22 | struct LocalImage_Example_Previews: PreviewProvider { 23 | static var previews: some View { 24 | LocalImage_Example() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Code/Toggle_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Toggle_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Toggle_Example: View { 11 | 12 | @State var toggleStatus: Bool = false 13 | 14 | var body: some View { 15 | 16 | Toggle("Toggle", isOn: $toggleStatus) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct Toggle_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | Toggle_Example() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/TextEditor_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextEditor.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TextEditor_Example: View { 11 | 12 | @State var textContent: String 13 | 14 | var body: some View { 15 | 16 | TextEditor(text: $textContent) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct TextEditor_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | TextEditor_Example(textContent: "") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/SFSymbolImage_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SFSymbolImage_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SFSymbolImage_Example: View { 11 | 12 | var body: some View { 13 | 14 | Image(systemName: "wand.and.stars") 15 | .font(.largeTitle) 16 | .foregroundColor(.blue) 17 | 18 | } 19 | 20 | } 21 | 22 | struct SFSymbolImage_Example_Previews: PreviewProvider { 23 | static var previews: some View { 24 | SFSymbolImage_Example() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Code/List_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // List_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct List_Example: View { 11 | 12 | let myCats = ["ネコノヒー", "ムギ", "レオ"] 13 | 14 | var body: some View { 15 | 16 | List(self.myCats, id: \.self) { catName in 17 | Text(catName) 18 | .font(.headline) 19 | } 20 | 21 | } 22 | 23 | } 24 | 25 | struct List_Example_Previews: PreviewProvider { 26 | static var previews: some View { 27 | List_Example() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Code/TextField_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextField_Example.swift 3 | // Preview_Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TextField_Example: View { 11 | 12 | @State var textEntered: String 13 | 14 | var body: some View { 15 | 16 | TextField("題名", text: $textEntered) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct TextField_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | TextField_Example(textEntered: "SwiftUI_Components-Library") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/ColorPicker_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ColorPicker_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ColorPicker_Example: View { 11 | 12 | @State var pickedColor: Color 13 | 14 | var body: some View { 15 | 16 | ColorPicker("Pick a color", selection: $pickedColor) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct ColorPicker_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | ColorPicker_Example(pickedColor: .blue) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/DatePicker_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DatePicker_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct DatePicker_Example: View { 11 | 12 | @State var selectedDate: Date 13 | 14 | var body: some View { 15 | 16 | DatePicker("日付を選んでください", selection: $selectedDate) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct DatePicker_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | DatePicker_Example(selectedDate: Date()) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/ForEachList_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ForEachList_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ForEachList_Example: View { 11 | 12 | let myCats = ["ネコノヒー", "ムギ", "レオ"] 13 | 14 | var body: some View { 15 | 16 | ForEach(self.myCats, id: \.self) { catName in 17 | Text(catName) 18 | .font(.headline) 19 | } 20 | 21 | } 22 | 23 | } 24 | 25 | struct ForEachList_Example_Previews: PreviewProvider { 26 | static var previews: some View { 27 | ForEachList_Example() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Code/SecureTextField_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SecureTextField_Example.swift 3 | // Preview_Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct SecureTextField_Example: View { 11 | 12 | @State var secureTextEntered: String 13 | 14 | var body: some View { 15 | 16 | SecureField("パスワード", text: $secureTextEntered) 17 | .padding() 18 | 19 | } 20 | 21 | } 22 | 23 | struct SecureTextField_Example_Previews: PreviewProvider { 24 | static var previews: some View { 25 | SecureTextField_Example(secureTextEntered: "abcde12345") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Code/Stepper_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Stepper_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/12/27. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Stepper_Example: View { 11 | 12 | @State var numberValue: Int = 0 13 | @State var numberValue_range: Int = 0 14 | 15 | var body: some View { 16 | 17 | Form { 18 | Stepper("\(numberValue)", value: $numberValue) 19 | 20 | Stepper("0 <= \(numberValue_range) <= 10", value: $numberValue_range, in: 0...10) 21 | } 22 | 23 | } 24 | 25 | } 26 | 27 | struct Stepper_Example_Previews: PreviewProvider { 28 | static var previews: some View { 29 | Stepper_Example() 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Code/ZStack_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ZStack_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ZStack_Example: View { 11 | 12 | var body: some View { 13 | 14 | ZStack { 15 | 16 | Circle() 17 | .frame(width: 100, height: 100) 18 | .foregroundColor(.blue) 19 | 20 | Image(systemName: "wand.and.stars") 21 | .font(.system(size: 28)) 22 | .foregroundColor(.white) 23 | 24 | } 25 | 26 | } 27 | 28 | } 29 | 30 | struct ZStack_Example_Previews: PreviewProvider { 31 | static var previews: some View { 32 | ZStack_Example() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Code/HStack_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HStack_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct HStack_Example: View { 11 | 12 | var body: some View { 13 | 14 | HStack { 15 | 16 | Image(systemName: "star.fill") 17 | .font(.largeTitle) 18 | .foregroundColor(.yellow) 19 | 20 | Image(systemName: "wand.and.stars") 21 | .font(.largeTitle) 22 | .foregroundColor(.blue) 23 | 24 | } 25 | 26 | } 27 | 28 | } 29 | 30 | struct HStack_Example_Previews: PreviewProvider { 31 | static var previews: some View { 32 | HStack_Example() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Code/Competible/SafariView_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // QLPreviewController_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | 11 | struct SafariView_Example: View { 12 | 13 | @State var showingWebview: Bool = false 14 | 15 | var body: some View { 16 | 17 | Button(action: { 18 | self.showingWebview = true 19 | }) { 20 | Text("表示する") 21 | } 22 | .sheet(isPresented: $showingWebview) { 23 | SafariView(url: URL(string: "https://mszmagic.com/")!) 24 | } 25 | 26 | } 27 | 28 | } 29 | 30 | struct SafariView_Example_Previews: PreviewProvider { 31 | static var previews: some View { 32 | SafariView_Example() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Code/NavigationView_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationView_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct NavigationView_Example: View { 11 | 12 | var body: some View { 13 | 14 | NavigationView { 15 | 16 | VStack { 17 | Text("Hello World!") 18 | .padding() 19 | Spacer() 20 | } 21 | .navigationBarTitle("NavigationView", displayMode: .inline) 22 | 23 | } 24 | .navigationViewStyle(StackNavigationViewStyle()) 25 | 26 | } 27 | 28 | } 29 | 30 | struct NavigationView_Example_Previews: PreviewProvider { 31 | static var previews: some View { 32 | NavigationView_Example() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Code/Picker_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Picker_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Picker_Example: View { 11 | 12 | @State var selectedCatIndex: Int = 0 13 | let myCats = [Cat(catName: "ネコノヒー"), Cat(catName: "ムギ"), Cat(catName: "レオ")] 14 | 15 | var body: some View { 16 | 17 | Picker("", selection: $selectedCatIndex) { 18 | ForEach(0 ..< myCats.count) { 19 | Text(self.myCats[$0].catName) 20 | } 21 | } 22 | 23 | Text("\(self.myCats[selectedCatIndex].catName)と言う名前の猫を選択しています") 24 | 25 | } 26 | 27 | } 28 | 29 | struct Picker_Example_Previews: PreviewProvider { 30 | static var previews: some View { 31 | Picker_Example() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Code/DisclosureGroup_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DisclosureGroup_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct DisclosureGroup_Example: View { 11 | 12 | @State var catMenuExpanded: Bool = false 13 | @State var dogMenuExpanded: Bool = false 14 | 15 | var body: some View { 16 | 17 | DisclosureGroup("私の猫たち", isExpanded: $catMenuExpanded) { 18 | Text("ネコノヒー") 19 | Text("ムギ") 20 | Text("レオ") 21 | }.padding() 22 | 23 | DisclosureGroup("私の犬たち", isExpanded: $dogMenuExpanded) { 24 | Text("アズキ") 25 | Text("マメ") 26 | }.padding() 27 | 28 | } 29 | 30 | } 31 | 32 | struct DisclosureGroup_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | DisclosureGroup_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/Alert_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Alert_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Alert_Example: View { 11 | 12 | @State var showAlert: Bool = false 13 | 14 | var body: some View { 15 | 16 | Button(action: { 17 | self.showAlert = true 18 | }) { 19 | Text("アラートウィンドウを表示") 20 | } 21 | .alert(isPresented: $showAlert) { 22 | Alert(title: Text("飼い猫に餌を与えたいですか?"), 23 | message: Text("オプションを選択してください。"), 24 | primaryButton: .default(Text("はい")), 25 | secondaryButton: .cancel()) 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | struct Alert_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | Alert_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/Competible/PhotoPickerController_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoPickerController_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | 11 | struct PhotoPickerController_Example: View { 12 | 13 | @State var showingPhotoPicker: Bool = false 14 | 15 | var body: some View { 16 | 17 | Button(action: { 18 | self.showingPhotoPicker = true 19 | }) { 20 | Text("表示する") 21 | } 22 | .sheet(isPresented: $showingPhotoPicker) { 23 | PhotoPickerView { (pickedImage) in 24 | return 25 | } 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | struct PhotoPickerController_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | PhotoPickerController_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/ProgressView_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressView_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ProgressView_Example: View { 11 | 12 | @State private var progressValue = 0.0 13 | 14 | var body: some View { 15 | 16 | ProgressView(value: progressValue) 17 | .onAppear(perform: { 18 | Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { (timer) in 19 | if (progressValue + 0.01 > 1.0) { 20 | timer.invalidate() 21 | } else { 22 | progressValue += 0.01 23 | } 24 | } 25 | }).padding() 26 | 27 | } 28 | 29 | } 30 | 31 | struct ProgressView_Example_Previews: PreviewProvider { 32 | static var previews: some View { 33 | ProgressView_Example() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Code/VStack_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VStack_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct VStack_Example: View { 11 | 12 | var body: some View { 13 | 14 | VStack(alignment: .center) { 15 | 16 | Text("Hello, World!") 17 | .padding() 18 | 19 | Button(action: { 20 | print("1") 21 | }) { 22 | Text("ボタン 1") 23 | } 24 | .padding() 25 | 26 | Button(action: { 27 | print("2") 28 | }) { 29 | Text("ボタン 2") 30 | } 31 | .padding() 32 | 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | struct VStack_Example_Previews: PreviewProvider { 40 | static var previews: some View { 41 | VStack_Example() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Code/Competible/MessageCompose_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MessageCompose_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | 11 | struct MessageCompose_Example: View { 12 | 13 | @State var showingMessageComposeView: Bool = false 14 | 15 | var body: some View { 16 | 17 | Button(action: { 18 | self.showingMessageComposeView = true 19 | }) { 20 | Text("表示する") 21 | } 22 | .sheet(isPresented: $showingMessageComposeView) { 23 | TextMessageComposerView(receipients: ["0123456789"], messageBody: "これはメッセージの例です") { (result) in 24 | print(result) 25 | } 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | struct MessageCompose_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | MessageCompose_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/Competible/PreviewController_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PreviewController_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | 11 | struct PreviewController_Example: View { 12 | 13 | @State var showingPreviewController: Bool = false 14 | 15 | var body: some View { 16 | 17 | Button(action: { 18 | self.showingPreviewController = true 19 | }) { 20 | Text("表示する") 21 | } 22 | .sheet(isPresented: $showingPreviewController) { 23 | QuickLookView(urls: [Bundle.main.url(forResource: "Example_Com_PDF", withExtension: "pdf")!]) { 24 | return 25 | } 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | struct PreviewController_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | PreviewController_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/Competible/EmailCompose_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EmailCompose_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | 11 | struct EmailCompose_Example: View { 12 | 13 | @State var showingMessageComposeView: Bool = false 14 | 15 | var body: some View { 16 | 17 | Button(action: { 18 | self.showingMessageComposeView = true 19 | }) { 20 | Text("表示する") 21 | } 22 | .sheet(isPresented: $showingMessageComposeView) { 23 | MailComposeView(receipients: ["mail@example.com"], mailSubject: "メールの例", mailBody: "this is an example message") { (result, error) in 24 | return 25 | } 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | struct EmailCompose_Example_Previews: PreviewProvider { 33 | static var previews: some View { 34 | EmailCompose_Example() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Code/ActionSheet_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheet_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ActionSheet_Example: View { 11 | 12 | @State var showActionSheet: Bool = false 13 | 14 | var body: some View { 15 | 16 | Button(action: { 17 | self.showActionSheet = true 18 | }) { 19 | Text("アラートウィンドウを表示") 20 | } 21 | .actionSheet(isPresented: $showActionSheet) { 22 | ActionSheet(title: Text("飼い猫に餌を与えたいですか?"), 23 | message: Text("オプションを選択してください。"), 24 | buttons: [ 25 | .default(Text("はい")), 26 | .cancel() 27 | ]) 28 | } 29 | 30 | } 31 | 32 | } 33 | 34 | struct ActionSheet_Example_Previews: PreviewProvider { 35 | static var previews: some View { 36 | ActionSheet_Example() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Code/Competible/FileBrowser_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FileBrowser_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | import SwiftUICompatible 10 | import MobileCoreServices 11 | 12 | struct FileBrowser_Example: View { 13 | 14 | @State var showFileBrowserView: Bool = false 15 | 16 | var body: some View { 17 | 18 | Button(action: { 19 | self.showFileBrowserView = true 20 | }) { 21 | Text("表示する") 22 | } 23 | .sheet(isPresented: $showFileBrowserView) { 24 | DocumentPicker(documentTypes: [String(kUTTypePDF)]) { (pickedURL) in 25 | print(pickedURL) 26 | } onCancel: { 27 | print("Cancelled") 28 | } 29 | } 30 | 31 | } 32 | 33 | } 34 | 35 | struct FileBrowser_Example_Previews: PreviewProvider { 36 | static var previews: some View { 37 | FileBrowser_Example() 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Code/FormList_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormList_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct FormList_Example: View { 11 | 12 | let myCats = ["ネコノヒー", "ムギ", "レオ"] 13 | let myDogs = ["アズキ", "マメ"] 14 | 15 | var body: some View { 16 | 17 | Form { 18 | 19 | Section(header: Text("私の犬たち")) { 20 | List(self.myDogs, id: \.self) { dogName in 21 | Text(dogName) 22 | .font(.headline) 23 | } 24 | } 25 | 26 | Section(header: Text("私の猫たち")) { 27 | List(self.myCats, id: \.self) { catName in 28 | Text(catName) 29 | .font(.headline) 30 | } 31 | } 32 | 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | struct FormList_Example_Previews: PreviewProvider { 40 | static var previews: some View { 41 | FormList_Example() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Code/ButtonSheet_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonSheet_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | import SwiftUI 8 | 9 | struct ButtonSheet_Example: View { 10 | 11 | @State var showAnotherView: Bool = false 12 | 13 | var body: some View { 14 | 15 | Form { 16 | 17 | Button(action: { 18 | self.showAnotherView = true 19 | }, label: { 20 | Text("別のビューを表示") 21 | }) 22 | .sheet(isPresented: $showAnotherView, content: { 23 | AnotherView(textContent: "Hello World.") 24 | }) 25 | 26 | } 27 | 28 | } 29 | } 30 | 31 | fileprivate struct AnotherView: View { 32 | 33 | var textContent: String 34 | 35 | var body: some View { 36 | 37 | Text(textContent) 38 | 39 | } 40 | 41 | } 42 | 43 | struct ButtonSheet_Example_Previews: PreviewProvider { 44 | static var previews: some View { 45 | ButtonSheet_Example() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Code/AlertItems_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Alert_Items_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Alert_Items_Example: View { 11 | 12 | let myCats = [Cat(catName: "ネコノヒー"), Cat(catName: "ムギ"), Cat(catName: "レオ")] 13 | 14 | @State var catItemToShow: Cat? = nil 15 | 16 | var body: some View { 17 | 18 | List(self.myCats) { item in 19 | Button(action: { 20 | self.catItemToShow = item 21 | }) { 22 | Text(item.catName) 23 | } 24 | } 25 | .alert(item: $catItemToShow) { cat in 26 | Alert(title: Text("あなたは猫の\(cat.catName)に餌を与えることを選択しました。"), 27 | message: Text("オプションを選択してください。"), 28 | primaryButton: .default(Text("はい")), 29 | secondaryButton: .cancel()) 30 | } 31 | 32 | } 33 | 34 | } 35 | 36 | struct Alert_Items_Example_Previews: PreviewProvider { 37 | static var previews: some View { 38 | Alert_Items_Example() 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Code/TabView_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BarView.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TabView_Example: View { 11 | 12 | var body: some View { 13 | 14 | TabView { 15 | 16 | AnotherView(textContent: "ビュー 1") 17 | .tabItem { 18 | Image(systemName: "note.text") 19 | Text("メモ") 20 | } 21 | 22 | AnotherView(textContent: "ビュー 2") 23 | .tabItem { 24 | Image(systemName: "gear") 25 | Text("設定") 26 | } 27 | 28 | } 29 | 30 | } 31 | 32 | } 33 | 34 | fileprivate struct AnotherView: View { 35 | 36 | var textContent: String 37 | 38 | var body: some View { 39 | 40 | Text(textContent) 41 | 42 | } 43 | 44 | } 45 | 46 | struct TabView_Example_Previews: PreviewProvider { 47 | static var previews: some View { 48 | TabView_Example() 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Code/LoginForm_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LoginForm_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/15. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct LoginForm_Example: View { 11 | 12 | var onSubmit: (String, String) -> Void 13 | 14 | @State private var userName: String = "" 15 | @State private var password: String = "" 16 | 17 | var body: some View { 18 | 19 | Form { 20 | 21 | Section { 22 | 23 | TextField("電子メールアドレス", text: $userName) 24 | 25 | SecureField("パスワード", text: $password) 26 | 27 | } 28 | 29 | Button(action: { 30 | self.onSubmit(userName, password) 31 | }) { 32 | Text("ログインする") 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | } 40 | 41 | struct LoginForm_Example_Previews: PreviewProvider { 42 | static var previews: some View { 43 | LoginForm_Example(onSubmit: { username, password in 44 | print("\(username) \(password)") 45 | }) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Code/ToolBar_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToolBar_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct ToolBar_Example: View { 11 | 12 | var body: some View { 13 | 14 | NavigationView { 15 | 16 | Text("Hello world!") 17 | .navigationTitle("ToolBar_Example") 18 | .toolbar(content: { 19 | // On the top left 20 | ToolbarItem(placement: .navigationBarLeading) { 21 | Text("ボタン") 22 | } 23 | // Or on the top right 24 | ToolbarItem(placement: .navigationBarTrailing) { 25 | Text("ボタン") 26 | } 27 | // Or on the bottom 28 | ToolbarItem(placement: .bottomBar) { 29 | Text("ボタン") 30 | } 31 | }) 32 | 33 | } 34 | 35 | } 36 | 37 | } 38 | 39 | struct ToolBar_Example_Previews: PreviewProvider { 40 | static var previews: some View { 41 | ToolBar_Example() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Code/SignInWithAppleButton_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SignInWithAppleButton_Example.swift 3 | // SwiftUI-Components-Library 4 | // 5 | // Created by Shunzhe Ma on R 2/10/16. 6 | // 7 | 8 | import SwiftUI 9 | import AuthenticationServices 10 | 11 | struct SignInWithAppleButton_Example: View { 12 | 13 | var body: some View { 14 | 15 | SignInWithAppleButton { (request) in 16 | print(request) 17 | } onCompletion: { (result) in 18 | switch result { 19 | case .success(let auth): 20 | if let credential = auth.credential as? ASAuthorizationAppleIDCredential { 21 | print(credential.user) 22 | print(credential.fullName ?? "") 23 | print(credential.email ?? "") 24 | } 25 | case .failure(let error): 26 | print(error) 27 | } 28 | } 29 | .frame(height: 50) 30 | .padding() 31 | 32 | 33 | } 34 | 35 | } 36 | 37 | struct SignInWithAppleButton_Example_Previews: PreviewProvider { 38 | static var previews: some View { 39 | SignInWithAppleButton_Example() 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Code/ButtonItemSheet_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ButtonItemSheet_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct Cat: Identifiable, Hashable { 11 | var id = UUID().uuidString 12 | var catName: String 13 | } 14 | 15 | struct ButtonItemSheet_Example: View { 16 | 17 | let myCats = [Cat(catName: "ネコノヒー"), Cat(catName: "ムギ"), Cat(catName: "レオ")] 18 | 19 | @State var catItemToShow: Cat? = nil 20 | 21 | var body: some View { 22 | 23 | List(self.myCats) { item in 24 | Button(action: { 25 | self.catItemToShow = item 26 | }) { 27 | Text(item.catName) 28 | } 29 | } 30 | .sheet(item: $catItemToShow) { item in 31 | AnotherView(textContent: item.catName) 32 | } 33 | 34 | } 35 | 36 | } 37 | 38 | fileprivate struct AnotherView: View { 39 | 40 | var textContent: String 41 | 42 | var body: some View { 43 | 44 | VStack { 45 | 46 | Text(textContent) 47 | .padding() 48 | 49 | Spacer() 50 | 51 | } 52 | 53 | } 54 | 55 | } 56 | 57 | struct ButtonItemSheet_Example_Previews: PreviewProvider { 58 | static var previews: some View { 59 | ButtonItemSheet_Example() 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Code/Map_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Map_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/11. 6 | // 7 | 8 | import SwiftUI 9 | import MapKit 10 | 11 | struct MapAnnotationItem: Identifiable { 12 | var id = UUID().uuidString 13 | var coordinate: CLLocationCoordinate2D 14 | } 15 | 16 | struct Map_Example: View { 17 | 18 | @State private var mapRegion: MKCoordinateRegion 19 | @State private var annotationCoordinates: [MapAnnotationItem] 20 | 21 | init(mapCenter: CLLocationCoordinate2D, mapSpan: CLLocationDistance = 500, annotationCoordinates: [MapAnnotationItem]) { 22 | _mapRegion = .init(initialValue: MKCoordinateRegion(center: mapCenter, latitudinalMeters: mapSpan, longitudinalMeters: mapSpan)) 23 | _annotationCoordinates = .init(initialValue: annotationCoordinates) 24 | } 25 | 26 | var body: some View { 27 | 28 | Map(coordinateRegion: $mapRegion, annotationItems: self.annotationCoordinates) { annotation in 29 | MapMarker(coordinate: annotation.coordinate, tint: .blue) 30 | }.ignoresSafeArea() 31 | 32 | } 33 | 34 | } 35 | 36 | struct Map_Example_Previews: PreviewProvider { 37 | static var previews: some View { 38 | let demoCoodinate = CLLocationCoordinate2D(latitude: 35.702069, longitude: 139.775327) 39 | Map_Example(mapCenter: demoCoodinate, annotationCoordinates: [MapAnnotationItem(coordinate: demoCoodinate)]) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Code/NavigationLink_Example.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationLink_Example.swift 3 | // Preview-Target 4 | // 5 | // Created by Shunzhe Ma on R 2/10/14. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct NavigationLink_Example: View { 11 | 12 | let myCats = ["ネコノヒー", "ムギ", "レオ"] 13 | 14 | var body: some View { 15 | 16 | /* 17 | `NavigationLink` を使用するには、このビューを `NavigationView` に含める必要があります。 18 | */ 19 | 20 | NavigationView { 21 | 22 | Form { 23 | 24 | List(self.myCats, id: \.self) { catName in 25 | NavigationLink( 26 | destination: AnotherView(textContent: catName), 27 | label: { 28 | //ここには、Text、Image、表の行の内容など、あらゆる種類のコンポーネントを追加できます。 29 | Text("別のビューを表示") 30 | }) 31 | } 32 | 33 | } 34 | .navigationBarTitle("私の猫たち", displayMode: .inline) 35 | 36 | } 37 | 38 | } 39 | } 40 | 41 | fileprivate struct AnotherView: View { 42 | 43 | var textContent: String 44 | 45 | var body: some View { 46 | 47 | Text(textContent) 48 | 49 | } 50 | 51 | } 52 | 53 | struct NavigationLink_Example_Previews: PreviewProvider { 54 | static var previews: some View { 55 | NavigationLink_Example() 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | 28 | UIApplicationSupportsIndirectInputEvents 29 | 30 | UILaunchScreen 31 | 32 | UIRequiredDeviceCapabilities 33 | 34 | armv7 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UISupportedInterfaceOrientations~ipad 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationPortraitUpsideDown 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | NSPhotoLibraryUsageDescription 50 | Access photo libraries. 51 | NSPhotoLibraryAddUsageDescription 52 | Access photo libraries. 53 | 54 | 55 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUI_Components-Library 2 | 3 | これは、`SwiftUI` の共通のビュー要素のコレクションです。`SwiftUI` を学び始めた初心者向けです。 4 | 5 | [SwiftUI ビューの基本フォーマット](#swiftui-ビューの基本フォーマット) 6 | 7 | [変数の型](#変数の型) 8 | 9 | [プレビュー](#プレビュー) 10 | 11 | [出発点](#出発点) 12 | 13 | [iOS 14の新機能 ](#ios-14-の新機能) 14 | 15 | [文字](#文字) 16 | 17 | [画像](#画像) 18 | 19 | [Table](#table) 20 | 21 | [Navigations](#navigations) 22 | 23 | [アクションを実行するにはユーザーに別のビューを表示するには](#アクションを実行するにはユーザーに別のビューを表示するには) 24 | 25 | [タブバー](#タブバー) 26 | 27 | [指定したオプションから1つの値を選択](#指定したオプションから1つの値を選択) 28 | 29 | [画面に複数の要素を表示](#画面に複数の要素を表示) 30 | 31 | [アラート / アクションシート](#アラート--アクションシート) 32 | 33 | [View modifiers](#viewmodifier-ビューモディファイア) 34 | 35 | [UIKit + SwiftUI](#uikit--swiftui) 36 | 37 | [プログラミング言語のSwiftUIに関する記事をさらに読むには、こちらをクリックしてください](https://mszmagic.com/ioskiji/#swiftui) 38 | 39 | # iOS 14 の新機能 40 | 41 | | TextEditor | ColorPicker | ToolbarItem | 42 | |---|---|---| 43 | | 長いテキストを表示および編集 | 色を選択できるようにします。 | バーにアイテムを表示します。 | 44 | | image | image | image | 45 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/TextEditor_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ColorPicker_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ToolBar_Example.swift){:target="_blank"} | 46 | 47 |

48 | 49 | | Map | DisclosureGroup | ProgressView | 50 | |---|---|---| 51 | | 注釈付きのマップを表示 | コンテンツを表示および非表示 | 進捗状況を表示 | 52 | | image | image | image | 53 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Map_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/DisclosureGroup_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ProgressView_Example.swift){:target="_blank"} | 54 | 55 |

56 | 57 | | TextEditor | DatePicker | Sign in with Apple | 58 | |---|---|---| 59 | | 長い文字列を表示して編集 | 日付を選択します | Appleでサインイン | 60 | | image | image | image | 61 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/TextEditor_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/DatePicker_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/SignInWithAppleButton_Example.swift){:target="_blank"} | 62 | 63 | | Stepper | 64 | |---| 65 | | 値を増減 | 66 | | image | 67 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Stepper_Example.swift){:target="_blank"} | 68 | 69 | # 文字 70 | 71 | | Text | TextField | SecureField | 72 | |---|---|---| 73 | | 1つの文字列を表示 | 編集可能なテキストフィールド | パスワード入力用の編集可能 | 74 | | image | image | image | 75 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Text_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/TextField_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/SecureTextField_Example.swift){:target="_blank"} | 76 | 77 | # 画像 78 | 79 | | Image (ローカルファイル) | Image (SFSymbol) | 80 | |---|---| 81 | | 画像を表示 | システム画像を表示 | 82 | | image | image | 83 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/LocalImage_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/SFSymbolImage_Example.swift){:target="_blank"} | 84 | 85 | # Table 86 | 87 | | List | ForEach | Form | 88 | |---|---|---| 89 | | image | image | image | 90 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/List_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ForEachList_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/FormList_Example.swift){:target="_blank"} | 91 | 92 | # Navigations 93 | 94 | | NavigationView | 95 | |---| 96 | | ナビゲーションビュー内に自前のViewを埋め込み | 97 | | image | 98 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/NavigationView_Example.swift){:target="_blank"} | 99 | 100 | # アクションを実行するには/ユーザーに別のビューを表示するには 101 | 102 | | Button | NavigationLink | ビューシート | 103 | |---|---|---| 104 | | クリックしてアクションを実行 | クリックして別のビューに移動 | ビューシートを表示 | 105 | | image | image | image | 106 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ButtonAction_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/NavigationLink_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ButtonSheet_Example.swift){:target="_blank"} [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ButtonItemSheet_Example.swift){:target="_blank"} | 107 | 108 | # タブバー 109 | 110 | | TabView | 111 | |---| 112 | | 画面の最下部にタブバーを表示 | 113 | | image | 114 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/TabView_Example.swift){:target="_blank"} | 115 | 116 | # 指定したオプションから1つの値を選択 117 | 118 | | Toggle | Picker | 119 | |---|---| 120 | | ユーザーが機能をオン/オフできるようにする | 指定したオプションから1つの値を選択 | 121 | | image | image | 122 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Toggle_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Picker_Example.swift){:target="_blank"} | 123 | 124 | # 画面に複数の要素を表示 125 | 126 | 上記ビューの複数を1つのビューに組み合わせて表示できます。 127 | 128 | | HStack | VStack | Form | 129 | |---|---|---| 130 | | 水平配置 | 垂直配置 | ログインフォームの例 | 131 | | image | image | image | 132 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/HStack_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/VStack_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/LoginForm_Example.swift){:target="_blank"} | 133 | 134 | | ZStack | 135 | |---| 136 | | 奥行き配置(前後) | 137 | | image | 138 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ZStack_Example.swift){:target="_blank"} | 139 | 140 | # アラート / アクションシート 141 | 142 | | Alert | ActionSheet | 143 | |---|---| 144 | | アラートウィンドウを表示 | アクションシートを画面の最下部に表示 | 145 | | image | image | 146 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Alert_Example.swift){:target="_blank"} [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/AlertItems_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/ActionSheet_Example.swift){:target="_blank"} | 147 | 148 |

149 | 150 | # ViewModifier ビューモディファイア 151 | 152 | ビューモディファイアを使ってビューの外観を変更することができます。 153 | 154 | 例: 155 | 156 | ```swift 157 | Image(systemName: "wand.and.stars") 158 | .font(.largeTitle) 159 | .foregroundColor(.blue) 160 | ``` 161 | 162 | 以下は一般的なビューモディファイアのリストです: 163 | 164 | | 変数名 | 使用法 | 165 | |---|---| 166 | | .font | 文字とSFシンボル (SF Symbol) 画像のフォントサイズを変更 | 167 | | .frame | 表示されるオブジェクトのサイズを変更 | 168 | | .padding() | オブジェクトの周囲にスペースを追加 | 169 | | .foregroundColor(.blue) | オブジェクトの色を変更 | 170 | | .onAppear | 画面にビューが表示されたときに実行するアクション | 171 | | .onTapGesture | ユーザーがビューをタップしたときにアクションを実行する | 172 | 173 | # UIKit + SwiftUI 174 | 175 | ## UIHostingController 176 | 177 | UIHostingControllerを使用して、UIKitビュー内にSwiftUIビューを表示することも可能です。 178 | 179 | ```swift 180 | let swiftuiView = Map_Example() 181 | let uiKitViewController = UIHostingController(rootView: swiftuiView) 182 | self.present(uiKitViewController, animated: true, completion: nil) 183 | ``` 184 | 185 | ## UIViewControllerRepresentable 186 | 187 | こちらのコード例は、`SwiftUICompatible` と呼ばれるフレームワークを使用しています。 188 | 189 | [`SwiftUICompatible` へアクセスするにはこちらをクリックしてください。](https://github.com/mszmagic/SwiftUICompatible) 190 | 191 | SwiftUI は新しいフレームワークであるので、フィーチャー UIKit の幾らかを欠いています。そららフィーチャー UIKit を活用する為には、UIViewControllerRepresentable を使用しなければなりません。 192 | 193 | | QuickLookView | PhotoPickerView | MailComposeView | 194 | |---|---|---| 195 | | ファイル内容をプレビュー | フォトピッカー | メールコンポーザー | 196 | | image | image | | 197 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/PreviewController_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/PhotoPickerController_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/EmailCompose_Example.swift){:target="_blank"} | 198 | 199 |

200 | 201 | | TextMessageComposerView | SafariView | DocumentPicker | 202 | |---|---|---| 203 | | テキストメッセージコンポーザー | ウェブ表示 | ドキュメントピッカー | 204 | | | image | image | 205 | | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/MessageCompose_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/SafariView_Example.swift){:target="_blank"} | [コード例を見る](https://github.com/mszmagic/SwiftUI-Components-Library/blob/main/Code/Competible/FileBrowser_Example.swift){:target="_blank"} | 206 | 207 | # SwiftUI ビューの基本フォーマット 208 | 209 | SwiftUI ビューの基本構造は次のとおり: 210 | 211 | ```swift 212 | import SwiftUI 213 | 214 | struct TextField_Example: View { 215 | 216 | // 変数 217 | 218 | var body: some View { 219 | 220 | //UIコンポーネント 221 | //Text, Image, Form, VStack, List, ... 222 | 223 | } 224 | 225 | } 226 | ``` 227 | 228 | `var body: some View` セクションで、ビューコードを入力。 229 | 230 | このWebページで提供されているサンプルコードでは、`body` コードブロック内のコンテンツに注意を払う必要がある。 231 | 232 | `// 変数` セクションで、変数を宣言する。 233 | 234 | # 変数の型 235 | 236 | お気づきになられたかもしれませんが、`SwiftUI` にはいくつもの型の変数があります。最もよく使われている変数の型2つを以下でご紹介します。 237 | 238 | ## @State 239 | 240 | ```swift 241 | struct ButtonSheet_Example: View { 242 | 243 | @State var showAnotherView: Bool = false 244 | 245 | var body: some View { 246 | 247 | Button(action: { 248 | self.showAnotherView = true 249 | }, label: { 250 | Text("別のビューを表示") 251 | }) 252 | .sheet(isPresented: $showAnotherView, content: { 253 | AnotherView(textContent: "Hello World.") 254 | }) 255 | 256 | } 257 | } 258 | ``` 259 | 260 | `@State` の値を変更することで、ビューの見た目に影響を与えることができます。 261 | 262 | 例えば、もしプログラムのどこかで `showAnotherView`が `true` に設定されていれば、ビュー `AnotherView` が表示されます。 263 | 264 | プログラムの中で `@State` 変数を使う時は、変数名の前に `$` 記号を付け加える必要があるかもしれません。そうすることで、ビューにその変数を監視(および変数が変更されればビューのコンテンツを更新)させることができます。 265 | 266 | `@State` 変数の値を次の3つの方法で初期化できます: 267 | 268 | 1. `@State var showAnotherView: Bool = false` 269 | 2. ビュー `ButtonSheet_Example` を初期化すると、変数を初期化できます。 `ButtonSheet_Example(showAnotherView: true)` 270 | 3. `init` 関数の中で変数を初期化できます: 271 | 272 | ```swift 273 | struct ButtonSheet_Example: View { 274 | 275 | @State var showAnotherView: Bool 276 | 277 | init(...) { 278 | self.showAnotherView = .init(initialValue: false) 279 | } 280 | 281 | var body: some View { 282 | // TODO 283 | } 284 | 285 | } 286 | ``` 287 | 288 | ## 変数 (var) 289 | 290 | 変数は値を格納するために利用されます。変数を更新してもプログラムの見た目に影響はありません。 291 | 292 | ```swift 293 | struct ButtonSheet_Example: View { 294 | 295 | var userTappedButton: () -> Void 296 | 297 | var body: some View { 298 | 299 | Button(action: { 300 | self.userTappedButton() 301 | }, label: { 302 | Text("別のビューを表示") 303 | }) 304 | 305 | } 306 | } 307 | ``` 308 | 309 | # プレビュー 310 | 311 | XcodeではSwiftUIファイルに加えた変更を直接プレビューすることができます。プレビューは以下のように宣言します。 312 | 313 | ```swift 314 | struct TextField_Example_Previews: PreviewProvider { 315 | static var previews: some View { 316 | TextField_Example(textEntered: "SwiftUI_Components-Library") 317 | } 318 | } 319 | ``` 320 | 321 | `static var previews: some View` 内で、SwiftUI表示を初期化していただけます。Xコードの右側にある `Resume` ボタンをクリックするとプレビューが表示されます。 322 | 323 | # 出発点 324 | 325 | 新規 `Xcode` プロジェクトを作成し、`SwiftUI App` の使用を選択することをお勧めします。それにより、練習用プロジェクトで上記のコンポーネントをお試しいただけます。 326 | 327 | # ⭐️ 328 | 329 | **質問をしよう**:[この問題ページで、自由に `SwiftUI` についての質問をしてください。](https://github.com/mszmagic/SwiftUI-Components-Library/issues){:target="_blank"} 330 | 331 | **コードの提供**:[コードを提供するためのGithub PRを自由に作成してください。](https://github.com/mszmagic/SwiftUI-Components-Library){:target="_blank"} 332 | 333 | [こちらのウェブページにアクセスすると、私の公開されているQiitaの記事のリストをカテゴリー別にご覧いただけます。](https://mszmagic.com/?page_id=16) 334 | 335 | -------------------------------------------------------------------------------- /SwiftUI-Components-Library.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 52; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DA0F1736253A5816008C5E7C /* DatePicker_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0F1735253A5816008C5E7C /* DatePicker_Example.swift */; }; 11 | DA0F1739253A5971008C5E7C /* SignInWithAppleButton_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0F1738253A5971008C5E7C /* SignInWithAppleButton_Example.swift */; }; 12 | DA6211EC259930BF00DAC95E /* Stepper_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA6211EB259930BF00DAC95E /* Stepper_Example.swift */; }; 13 | DAC28B912537CC69009751EB /* SwiftUI_Components_LibraryApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28B902537CC69009751EB /* SwiftUI_Components_LibraryApp.swift */; }; 14 | DAC28B952537CC69009751EB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DAC28B942537CC69009751EB /* Assets.xcassets */; }; 15 | DAC28B982537CC69009751EB /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DAC28B972537CC69009751EB /* Preview Assets.xcassets */; }; 16 | DAC28BBC2537CC91009751EB /* TextField_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA12537CC91009751EB /* TextField_Example.swift */; }; 17 | DAC28BBD2537CC91009751EB /* ButtonAction_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA22537CC91009751EB /* ButtonAction_Example.swift */; }; 18 | DAC28BBE2537CC91009751EB /* FormList_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA32537CC91009751EB /* FormList_Example.swift */; }; 19 | DAC28BBF2537CC91009751EB /* SFSymbolImage_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA42537CC91009751EB /* SFSymbolImage_Example.swift */; }; 20 | DAC28BC02537CC91009751EB /* ActionSheet_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA52537CC91009751EB /* ActionSheet_Example.swift */; }; 21 | DAC28BC12537CC91009751EB /* LocalImage_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA62537CC91009751EB /* LocalImage_Example.swift */; }; 22 | DAC28BC22537CC91009751EB /* TabView_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA72537CC91009751EB /* TabView_Example.swift */; }; 23 | DAC28BC32537CC91009751EB /* DisclosureGroup_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA82537CC91009751EB /* DisclosureGroup_Example.swift */; }; 24 | DAC28BC42537CC91009751EB /* Picker_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BA92537CC91009751EB /* Picker_Example.swift */; }; 25 | DAC28BC52537CC91009751EB /* SecureTextField_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAA2537CC91009751EB /* SecureTextField_Example.swift */; }; 26 | DAC28BC62537CC91009751EB /* TextEditor_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAB2537CC91009751EB /* TextEditor_Example.swift */; }; 27 | DAC28BC72537CC91009751EB /* ProgressView_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAC2537CC91009751EB /* ProgressView_Example.swift */; }; 28 | DAC28BC82537CC91009751EB /* ButtonItemSheet_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAD2537CC91009751EB /* ButtonItemSheet_Example.swift */; }; 29 | DAC28BC92537CC91009751EB /* ButtonSheet_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAE2537CC91009751EB /* ButtonSheet_Example.swift */; }; 30 | DAC28BCA2537CC91009751EB /* Map_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BAF2537CC91009751EB /* Map_Example.swift */; }; 31 | DAC28BCB2537CC91009751EB /* SafariView_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB12537CC91009751EB /* SafariView_Example.swift */; }; 32 | DAC28BCC2537CC91009751EB /* ToolBar_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB22537CC91009751EB /* ToolBar_Example.swift */; }; 33 | DAC28BCD2537CC91009751EB /* NavigationView_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB32537CC91009751EB /* NavigationView_Example.swift */; }; 34 | DAC28BCE2537CC91009751EB /* ColorPicker_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB42537CC91009751EB /* ColorPicker_Example.swift */; }; 35 | DAC28BCF2537CC91009751EB /* Alert_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB52537CC91009751EB /* Alert_Example.swift */; }; 36 | DAC28BD02537CC91009751EB /* NavigationLink_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB62537CC91009751EB /* NavigationLink_Example.swift */; }; 37 | DAC28BD12537CC91009751EB /* AlertItems_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB72537CC91009751EB /* AlertItems_Example.swift */; }; 38 | DAC28BD22537CC91009751EB /* List_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB82537CC91009751EB /* List_Example.swift */; }; 39 | DAC28BD32537CC91009751EB /* Text_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BB92537CC91009751EB /* Text_Example.swift */; }; 40 | DAC28BD42537CC91009751EB /* Toggle_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BBA2537CC91009751EB /* Toggle_Example.swift */; }; 41 | DAC28BD52537CC91009751EB /* ForEachList_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BBB2537CC91009751EB /* ForEachList_Example.swift */; }; 42 | DAC28BDA2537CCBC009751EB /* SwiftUICompatible in Frameworks */ = {isa = PBXBuildFile; productRef = DAC28BD92537CCBC009751EB /* SwiftUICompatible */; }; 43 | DAC28BE22537CF28009751EB /* FileBrowser_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BE12537CF28009751EB /* FileBrowser_Example.swift */; }; 44 | DAC28BE52537D001009751EB /* MessageCompose_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BE42537D001009751EB /* MessageCompose_Example.swift */; }; 45 | DAC28BE82537D0FE009751EB /* EmailCompose_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BE72537D0FE009751EB /* EmailCompose_Example.swift */; }; 46 | DAC28BEB2537D1A6009751EB /* PreviewController_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BEA2537D1A6009751EB /* PreviewController_Example.swift */; }; 47 | DAC28BF22537D2BE009751EB /* Example_Com_PDF.pdf in Resources */ = {isa = PBXBuildFile; fileRef = DAC28BF12537D2BE009751EB /* Example_Com_PDF.pdf */; }; 48 | DAC28BF52537D355009751EB /* PhotoPickerController_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC28BF42537D355009751EB /* PhotoPickerController_Example.swift */; }; 49 | DAFE9CB52538991C0036FB2B /* HStack_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAFE9CB42538991C0036FB2B /* HStack_Example.swift */; }; 50 | DAFE9CB8253899230036FB2B /* VStack_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAFE9CB7253899230036FB2B /* VStack_Example.swift */; }; 51 | DAFE9CBB2538992B0036FB2B /* LoginForm_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAFE9CBA2538992B0036FB2B /* LoginForm_Example.swift */; }; 52 | DAFE9CBE2538A0C90036FB2B /* ZStack_Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAFE9CBD2538A0C90036FB2B /* ZStack_Example.swift */; }; 53 | /* End PBXBuildFile section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | DA0F1735253A5816008C5E7C /* DatePicker_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatePicker_Example.swift; sourceTree = ""; }; 57 | DA0F1738253A5971008C5E7C /* SignInWithAppleButton_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithAppleButton_Example.swift; sourceTree = ""; }; 58 | DA6211EB259930BF00DAC95E /* Stepper_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stepper_Example.swift; sourceTree = ""; }; 59 | DAC28B8D2537CC69009751EB /* SwiftUI-Components-Library.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SwiftUI-Components-Library.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | DAC28B902537CC69009751EB /* SwiftUI_Components_LibraryApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUI_Components_LibraryApp.swift; sourceTree = ""; }; 61 | DAC28B942537CC69009751EB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 62 | DAC28B972537CC69009751EB /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 63 | DAC28B992537CC69009751EB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64 | DAC28BA12537CC91009751EB /* TextField_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField_Example.swift; sourceTree = ""; }; 65 | DAC28BA22537CC91009751EB /* ButtonAction_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonAction_Example.swift; sourceTree = ""; }; 66 | DAC28BA32537CC91009751EB /* FormList_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormList_Example.swift; sourceTree = ""; }; 67 | DAC28BA42537CC91009751EB /* SFSymbolImage_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SFSymbolImage_Example.swift; sourceTree = ""; }; 68 | DAC28BA52537CC91009751EB /* ActionSheet_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionSheet_Example.swift; sourceTree = ""; }; 69 | DAC28BA62537CC91009751EB /* LocalImage_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocalImage_Example.swift; sourceTree = ""; }; 70 | DAC28BA72537CC91009751EB /* TabView_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabView_Example.swift; sourceTree = ""; }; 71 | DAC28BA82537CC91009751EB /* DisclosureGroup_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisclosureGroup_Example.swift; sourceTree = ""; }; 72 | DAC28BA92537CC91009751EB /* Picker_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Picker_Example.swift; sourceTree = ""; }; 73 | DAC28BAA2537CC91009751EB /* SecureTextField_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecureTextField_Example.swift; sourceTree = ""; }; 74 | DAC28BAB2537CC91009751EB /* TextEditor_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextEditor_Example.swift; sourceTree = ""; }; 75 | DAC28BAC2537CC91009751EB /* ProgressView_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressView_Example.swift; sourceTree = ""; }; 76 | DAC28BAD2537CC91009751EB /* ButtonItemSheet_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonItemSheet_Example.swift; sourceTree = ""; }; 77 | DAC28BAE2537CC91009751EB /* ButtonSheet_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonSheet_Example.swift; sourceTree = ""; }; 78 | DAC28BAF2537CC91009751EB /* Map_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Map_Example.swift; sourceTree = ""; }; 79 | DAC28BB12537CC91009751EB /* SafariView_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SafariView_Example.swift; sourceTree = ""; }; 80 | DAC28BB22537CC91009751EB /* ToolBar_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToolBar_Example.swift; sourceTree = ""; }; 81 | DAC28BB32537CC91009751EB /* NavigationView_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationView_Example.swift; sourceTree = ""; }; 82 | DAC28BB42537CC91009751EB /* ColorPicker_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorPicker_Example.swift; sourceTree = ""; }; 83 | DAC28BB52537CC91009751EB /* Alert_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Alert_Example.swift; sourceTree = ""; }; 84 | DAC28BB62537CC91009751EB /* NavigationLink_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NavigationLink_Example.swift; sourceTree = ""; }; 85 | DAC28BB72537CC91009751EB /* AlertItems_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertItems_Example.swift; sourceTree = ""; }; 86 | DAC28BB82537CC91009751EB /* List_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = List_Example.swift; sourceTree = ""; }; 87 | DAC28BB92537CC91009751EB /* Text_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Text_Example.swift; sourceTree = ""; }; 88 | DAC28BBA2537CC91009751EB /* Toggle_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Toggle_Example.swift; sourceTree = ""; }; 89 | DAC28BBB2537CC91009751EB /* ForEachList_Example.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ForEachList_Example.swift; sourceTree = ""; }; 90 | DAC28BDC2537CE3D009751EB /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; 91 | DAC28BE12537CF28009751EB /* FileBrowser_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileBrowser_Example.swift; sourceTree = ""; }; 92 | DAC28BE42537D001009751EB /* MessageCompose_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageCompose_Example.swift; sourceTree = ""; }; 93 | DAC28BE72537D0FE009751EB /* EmailCompose_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmailCompose_Example.swift; sourceTree = ""; }; 94 | DAC28BEA2537D1A6009751EB /* PreviewController_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewController_Example.swift; sourceTree = ""; }; 95 | DAC28BF12537D2BE009751EB /* Example_Com_PDF.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Example_Com_PDF.pdf; sourceTree = ""; }; 96 | DAC28BF42537D355009751EB /* PhotoPickerController_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoPickerController_Example.swift; sourceTree = ""; }; 97 | DAFE9CB42538991C0036FB2B /* HStack_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HStack_Example.swift; sourceTree = ""; }; 98 | DAFE9CB7253899230036FB2B /* VStack_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VStack_Example.swift; sourceTree = ""; }; 99 | DAFE9CBA2538992B0036FB2B /* LoginForm_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginForm_Example.swift; sourceTree = ""; }; 100 | DAFE9CBD2538A0C90036FB2B /* ZStack_Example.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZStack_Example.swift; sourceTree = ""; }; 101 | /* End PBXFileReference section */ 102 | 103 | /* Begin PBXFrameworksBuildPhase section */ 104 | DAC28B8A2537CC69009751EB /* Frameworks */ = { 105 | isa = PBXFrameworksBuildPhase; 106 | buildActionMask = 2147483647; 107 | files = ( 108 | DAC28BDA2537CCBC009751EB /* SwiftUICompatible in Frameworks */, 109 | ); 110 | runOnlyForDeploymentPostprocessing = 0; 111 | }; 112 | /* End PBXFrameworksBuildPhase section */ 113 | 114 | /* Begin PBXGroup section */ 115 | DAC28B842537CC69009751EB = { 116 | isa = PBXGroup; 117 | children = ( 118 | DAC28B8F2537CC69009751EB /* SwiftUI-Components-Library */, 119 | DAC28B8E2537CC69009751EB /* Products */, 120 | ); 121 | sourceTree = ""; 122 | }; 123 | DAC28B8E2537CC69009751EB /* Products */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | DAC28B8D2537CC69009751EB /* SwiftUI-Components-Library.app */, 127 | ); 128 | name = Products; 129 | sourceTree = ""; 130 | }; 131 | DAC28B8F2537CC69009751EB /* SwiftUI-Components-Library */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | DAC28BDC2537CE3D009751EB /* README.md */, 135 | DAC28B902537CC69009751EB /* SwiftUI_Components_LibraryApp.swift */, 136 | DAC28BA02537CC91009751EB /* Code */, 137 | DAC28B942537CC69009751EB /* Assets.xcassets */, 138 | DAC28BF12537D2BE009751EB /* Example_Com_PDF.pdf */, 139 | DAC28B992537CC69009751EB /* Info.plist */, 140 | DAC28B962537CC69009751EB /* Preview Content */, 141 | ); 142 | path = "SwiftUI-Components-Library"; 143 | sourceTree = ""; 144 | }; 145 | DAC28B962537CC69009751EB /* Preview Content */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | DAC28B972537CC69009751EB /* Preview Assets.xcassets */, 149 | ); 150 | path = "Preview Content"; 151 | sourceTree = ""; 152 | }; 153 | DAC28BA02537CC91009751EB /* Code */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | DAC28BB02537CC91009751EB /* Competible */, 157 | DAC28BA12537CC91009751EB /* TextField_Example.swift */, 158 | DAC28BA22537CC91009751EB /* ButtonAction_Example.swift */, 159 | DAC28BA32537CC91009751EB /* FormList_Example.swift */, 160 | DAC28BA42537CC91009751EB /* SFSymbolImage_Example.swift */, 161 | DAC28BA52537CC91009751EB /* ActionSheet_Example.swift */, 162 | DAC28BA62537CC91009751EB /* LocalImage_Example.swift */, 163 | DAC28BA72537CC91009751EB /* TabView_Example.swift */, 164 | DAC28BA82537CC91009751EB /* DisclosureGroup_Example.swift */, 165 | DAC28BA92537CC91009751EB /* Picker_Example.swift */, 166 | DAC28BAA2537CC91009751EB /* SecureTextField_Example.swift */, 167 | DAC28BAB2537CC91009751EB /* TextEditor_Example.swift */, 168 | DAC28BAC2537CC91009751EB /* ProgressView_Example.swift */, 169 | DAC28BAD2537CC91009751EB /* ButtonItemSheet_Example.swift */, 170 | DAC28BAE2537CC91009751EB /* ButtonSheet_Example.swift */, 171 | DAC28BAF2537CC91009751EB /* Map_Example.swift */, 172 | DAC28BB22537CC91009751EB /* ToolBar_Example.swift */, 173 | DAC28BB32537CC91009751EB /* NavigationView_Example.swift */, 174 | DAC28BB42537CC91009751EB /* ColorPicker_Example.swift */, 175 | DAC28BB52537CC91009751EB /* Alert_Example.swift */, 176 | DAC28BB62537CC91009751EB /* NavigationLink_Example.swift */, 177 | DAC28BB72537CC91009751EB /* AlertItems_Example.swift */, 178 | DAC28BB82537CC91009751EB /* List_Example.swift */, 179 | DAC28BB92537CC91009751EB /* Text_Example.swift */, 180 | DAC28BBA2537CC91009751EB /* Toggle_Example.swift */, 181 | DAC28BBB2537CC91009751EB /* ForEachList_Example.swift */, 182 | DAFE9CB42538991C0036FB2B /* HStack_Example.swift */, 183 | DAFE9CB7253899230036FB2B /* VStack_Example.swift */, 184 | DAFE9CBD2538A0C90036FB2B /* ZStack_Example.swift */, 185 | DAFE9CBA2538992B0036FB2B /* LoginForm_Example.swift */, 186 | DA0F1735253A5816008C5E7C /* DatePicker_Example.swift */, 187 | DA0F1738253A5971008C5E7C /* SignInWithAppleButton_Example.swift */, 188 | DA6211EB259930BF00DAC95E /* Stepper_Example.swift */, 189 | ); 190 | path = Code; 191 | sourceTree = SOURCE_ROOT; 192 | }; 193 | DAC28BB02537CC91009751EB /* Competible */ = { 194 | isa = PBXGroup; 195 | children = ( 196 | DAC28BB12537CC91009751EB /* SafariView_Example.swift */, 197 | DAC28BE12537CF28009751EB /* FileBrowser_Example.swift */, 198 | DAC28BE42537D001009751EB /* MessageCompose_Example.swift */, 199 | DAC28BE72537D0FE009751EB /* EmailCompose_Example.swift */, 200 | DAC28BEA2537D1A6009751EB /* PreviewController_Example.swift */, 201 | DAC28BF42537D355009751EB /* PhotoPickerController_Example.swift */, 202 | ); 203 | path = Competible; 204 | sourceTree = ""; 205 | }; 206 | /* End PBXGroup section */ 207 | 208 | /* Begin PBXNativeTarget section */ 209 | DAC28B8C2537CC69009751EB /* SwiftUI-Components-Library */ = { 210 | isa = PBXNativeTarget; 211 | buildConfigurationList = DAC28B9C2537CC69009751EB /* Build configuration list for PBXNativeTarget "SwiftUI-Components-Library" */; 212 | buildPhases = ( 213 | DAC28B892537CC69009751EB /* Sources */, 214 | DAC28B8A2537CC69009751EB /* Frameworks */, 215 | DAC28B8B2537CC69009751EB /* Resources */, 216 | ); 217 | buildRules = ( 218 | ); 219 | dependencies = ( 220 | ); 221 | name = "SwiftUI-Components-Library"; 222 | packageProductDependencies = ( 223 | DAC28BD92537CCBC009751EB /* SwiftUICompatible */, 224 | ); 225 | productName = "SwiftUI-Components-Library"; 226 | productReference = DAC28B8D2537CC69009751EB /* SwiftUI-Components-Library.app */; 227 | productType = "com.apple.product-type.application"; 228 | }; 229 | /* End PBXNativeTarget section */ 230 | 231 | /* Begin PBXProject section */ 232 | DAC28B852537CC69009751EB /* Project object */ = { 233 | isa = PBXProject; 234 | attributes = { 235 | LastSwiftUpdateCheck = 1200; 236 | LastUpgradeCheck = 1200; 237 | TargetAttributes = { 238 | DAC28B8C2537CC69009751EB = { 239 | CreatedOnToolsVersion = 12.0; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = DAC28B882537CC69009751EB /* Build configuration list for PBXProject "SwiftUI-Components-Library" */; 244 | compatibilityVersion = "Xcode 9.3"; 245 | developmentRegion = en; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = DAC28B842537CC69009751EB; 252 | packageReferences = ( 253 | DAC28BD82537CCBC009751EB /* XCRemoteSwiftPackageReference "SwiftUICompatible" */, 254 | ); 255 | productRefGroup = DAC28B8E2537CC69009751EB /* Products */; 256 | projectDirPath = ""; 257 | projectRoot = ""; 258 | targets = ( 259 | DAC28B8C2537CC69009751EB /* SwiftUI-Components-Library */, 260 | ); 261 | }; 262 | /* End PBXProject section */ 263 | 264 | /* Begin PBXResourcesBuildPhase section */ 265 | DAC28B8B2537CC69009751EB /* Resources */ = { 266 | isa = PBXResourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | DAC28BF22537D2BE009751EB /* Example_Com_PDF.pdf in Resources */, 270 | DAC28B982537CC69009751EB /* Preview Assets.xcassets in Resources */, 271 | DAC28B952537CC69009751EB /* Assets.xcassets in Resources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | /* End PBXResourcesBuildPhase section */ 276 | 277 | /* Begin PBXSourcesBuildPhase section */ 278 | DAC28B892537CC69009751EB /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | DAC28BD12537CC91009751EB /* AlertItems_Example.swift in Sources */, 283 | DAC28BD32537CC91009751EB /* Text_Example.swift in Sources */, 284 | DAC28BE52537D001009751EB /* MessageCompose_Example.swift in Sources */, 285 | DAC28BC02537CC91009751EB /* ActionSheet_Example.swift in Sources */, 286 | DAC28BCB2537CC91009751EB /* SafariView_Example.swift in Sources */, 287 | DAC28BC82537CC91009751EB /* ButtonItemSheet_Example.swift in Sources */, 288 | DAFE9CBB2538992B0036FB2B /* LoginForm_Example.swift in Sources */, 289 | DAC28BCF2537CC91009751EB /* Alert_Example.swift in Sources */, 290 | DAC28BCA2537CC91009751EB /* Map_Example.swift in Sources */, 291 | DAFE9CB52538991C0036FB2B /* HStack_Example.swift in Sources */, 292 | DAC28BEB2537D1A6009751EB /* PreviewController_Example.swift in Sources */, 293 | DAC28BE82537D0FE009751EB /* EmailCompose_Example.swift in Sources */, 294 | DAC28BCD2537CC91009751EB /* NavigationView_Example.swift in Sources */, 295 | DAC28BCC2537CC91009751EB /* ToolBar_Example.swift in Sources */, 296 | DAC28BBF2537CC91009751EB /* SFSymbolImage_Example.swift in Sources */, 297 | DA0F1739253A5971008C5E7C /* SignInWithAppleButton_Example.swift in Sources */, 298 | DAFE9CB8253899230036FB2B /* VStack_Example.swift in Sources */, 299 | DAC28BC92537CC91009751EB /* ButtonSheet_Example.swift in Sources */, 300 | DAC28BBE2537CC91009751EB /* FormList_Example.swift in Sources */, 301 | DA6211EC259930BF00DAC95E /* Stepper_Example.swift in Sources */, 302 | DAC28BC12537CC91009751EB /* LocalImage_Example.swift in Sources */, 303 | DAC28B912537CC69009751EB /* SwiftUI_Components_LibraryApp.swift in Sources */, 304 | DAC28BD52537CC91009751EB /* ForEachList_Example.swift in Sources */, 305 | DAC28BBD2537CC91009751EB /* ButtonAction_Example.swift in Sources */, 306 | DAC28BC32537CC91009751EB /* DisclosureGroup_Example.swift in Sources */, 307 | DAC28BC22537CC91009751EB /* TabView_Example.swift in Sources */, 308 | DAC28BD22537CC91009751EB /* List_Example.swift in Sources */, 309 | DA0F1736253A5816008C5E7C /* DatePicker_Example.swift in Sources */, 310 | DAC28BC42537CC91009751EB /* Picker_Example.swift in Sources */, 311 | DAC28BC72537CC91009751EB /* ProgressView_Example.swift in Sources */, 312 | DAC28BC62537CC91009751EB /* TextEditor_Example.swift in Sources */, 313 | DAC28BCE2537CC91009751EB /* ColorPicker_Example.swift in Sources */, 314 | DAC28BD42537CC91009751EB /* Toggle_Example.swift in Sources */, 315 | DAC28BD02537CC91009751EB /* NavigationLink_Example.swift in Sources */, 316 | DAC28BBC2537CC91009751EB /* TextField_Example.swift in Sources */, 317 | DAC28BF52537D355009751EB /* PhotoPickerController_Example.swift in Sources */, 318 | DAC28BC52537CC91009751EB /* SecureTextField_Example.swift in Sources */, 319 | DAFE9CBE2538A0C90036FB2B /* ZStack_Example.swift in Sources */, 320 | DAC28BE22537CF28009751EB /* FileBrowser_Example.swift in Sources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | /* End PBXSourcesBuildPhase section */ 325 | 326 | /* Begin XCBuildConfiguration section */ 327 | DAC28B9A2537CC69009751EB /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | ALWAYS_SEARCH_USER_PATHS = NO; 331 | CLANG_ANALYZER_NONNULL = YES; 332 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 333 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 334 | CLANG_CXX_LIBRARY = "libc++"; 335 | CLANG_ENABLE_MODULES = YES; 336 | CLANG_ENABLE_OBJC_ARC = YES; 337 | CLANG_ENABLE_OBJC_WEAK = YES; 338 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_COMMA = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 344 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 345 | CLANG_WARN_EMPTY_BODY = YES; 346 | CLANG_WARN_ENUM_CONVERSION = YES; 347 | CLANG_WARN_INFINITE_RECURSION = YES; 348 | CLANG_WARN_INT_CONVERSION = YES; 349 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 350 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 351 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu11; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 379 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 380 | MTL_FAST_MATH = YES; 381 | ONLY_ACTIVE_ARCH = YES; 382 | SDKROOT = iphoneos; 383 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 384 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 385 | }; 386 | name = Debug; 387 | }; 388 | DAC28B9B2537CC69009751EB /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ALWAYS_SEARCH_USER_PATHS = NO; 392 | CLANG_ANALYZER_NONNULL = YES; 393 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_ENABLE_OBJC_WEAK = YES; 399 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 400 | CLANG_WARN_BOOL_CONVERSION = YES; 401 | CLANG_WARN_COMMA = YES; 402 | CLANG_WARN_CONSTANT_CONVERSION = YES; 403 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 412 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 413 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 414 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 415 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 416 | CLANG_WARN_STRICT_PROTOTYPES = YES; 417 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 418 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 419 | CLANG_WARN_UNREACHABLE_CODE = YES; 420 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 421 | COPY_PHASE_STRIP = NO; 422 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 423 | ENABLE_NS_ASSERTIONS = NO; 424 | ENABLE_STRICT_OBJC_MSGSEND = YES; 425 | GCC_C_LANGUAGE_STANDARD = gnu11; 426 | GCC_NO_COMMON_BLOCKS = YES; 427 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 428 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 429 | GCC_WARN_UNDECLARED_SELECTOR = YES; 430 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 431 | GCC_WARN_UNUSED_FUNCTION = YES; 432 | GCC_WARN_UNUSED_VARIABLE = YES; 433 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 434 | MTL_ENABLE_DEBUG_INFO = NO; 435 | MTL_FAST_MATH = YES; 436 | SDKROOT = iphoneos; 437 | SWIFT_COMPILATION_MODE = wholemodule; 438 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 439 | VALIDATE_PRODUCT = YES; 440 | }; 441 | name = Release; 442 | }; 443 | DAC28B9D2537CC69009751EB /* Debug */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 448 | CODE_SIGN_STYLE = Automatic; 449 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-Components-Library/Preview Content\""; 450 | DEVELOPMENT_TEAM = 9LFMJA3SC2; 451 | ENABLE_PREVIEWS = YES; 452 | INFOPLIST_FILE = "SwiftUI-Components-Library/Info.plist"; 453 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 454 | LD_RUNPATH_SEARCH_PATHS = ( 455 | "$(inherited)", 456 | "@executable_path/Frameworks", 457 | ); 458 | PRODUCT_BUNDLE_IDENTIFIER = "com.ShunzheMa.SwiftUI-Components-Library"; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | SWIFT_VERSION = 5.0; 461 | TARGETED_DEVICE_FAMILY = "1,2"; 462 | }; 463 | name = Debug; 464 | }; 465 | DAC28B9E2537CC69009751EB /* Release */ = { 466 | isa = XCBuildConfiguration; 467 | buildSettings = { 468 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 469 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 470 | CODE_SIGN_STYLE = Automatic; 471 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUI-Components-Library/Preview Content\""; 472 | DEVELOPMENT_TEAM = 9LFMJA3SC2; 473 | ENABLE_PREVIEWS = YES; 474 | INFOPLIST_FILE = "SwiftUI-Components-Library/Info.plist"; 475 | IPHONEOS_DEPLOYMENT_TARGET = 14.0; 476 | LD_RUNPATH_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "@executable_path/Frameworks", 479 | ); 480 | PRODUCT_BUNDLE_IDENTIFIER = "com.ShunzheMa.SwiftUI-Components-Library"; 481 | PRODUCT_NAME = "$(TARGET_NAME)"; 482 | SWIFT_VERSION = 5.0; 483 | TARGETED_DEVICE_FAMILY = "1,2"; 484 | }; 485 | name = Release; 486 | }; 487 | /* End XCBuildConfiguration section */ 488 | 489 | /* Begin XCConfigurationList section */ 490 | DAC28B882537CC69009751EB /* Build configuration list for PBXProject "SwiftUI-Components-Library" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | DAC28B9A2537CC69009751EB /* Debug */, 494 | DAC28B9B2537CC69009751EB /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | DAC28B9C2537CC69009751EB /* Build configuration list for PBXNativeTarget "SwiftUI-Components-Library" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | DAC28B9D2537CC69009751EB /* Debug */, 503 | DAC28B9E2537CC69009751EB /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | /* End XCConfigurationList section */ 509 | 510 | /* Begin XCRemoteSwiftPackageReference section */ 511 | DAC28BD82537CCBC009751EB /* XCRemoteSwiftPackageReference "SwiftUICompatible" */ = { 512 | isa = XCRemoteSwiftPackageReference; 513 | repositoryURL = "https://github.com/mszmagic/SwiftUICompatible.git"; 514 | requirement = { 515 | kind = upToNextMajorVersion; 516 | minimumVersion = 1.0.6; 517 | }; 518 | }; 519 | /* End XCRemoteSwiftPackageReference section */ 520 | 521 | /* Begin XCSwiftPackageProductDependency section */ 522 | DAC28BD92537CCBC009751EB /* SwiftUICompatible */ = { 523 | isa = XCSwiftPackageProductDependency; 524 | package = DAC28BD82537CCBC009751EB /* XCRemoteSwiftPackageReference "SwiftUICompatible" */; 525 | productName = SwiftUICompatible; 526 | }; 527 | /* End XCSwiftPackageProductDependency section */ 528 | }; 529 | rootObject = DAC28B852537CC69009751EB /* Project object */; 530 | } 531 | --------------------------------------------------------------------------------