├── DrawingApp ├── images │ └── image1.png ├── DrawingApp │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── ContentView.swift │ ├── Model │ │ └── DrawPoints.swift │ ├── UIView+Extension.swift │ ├── AppDelegate.swift │ ├── View │ │ └── DrawingViewModel.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── README.md ├── DrawingApp.xcodeproj │ └── xcuserdata │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── DrawingAppTests │ ├── Info.plist │ └── DrawingAppTests.swift └── DrawingAppUITests │ ├── Info.plist │ └── DrawingAppUITests.swift ├── BasicViews ├── BasicViews │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── wing.imageset │ │ │ ├── wing.png │ │ │ └── Contents.json │ │ ├── seal_1.imageset │ │ │ ├── seal_1.png │ │ │ └── Contents.json │ │ ├── seal_2.imageset │ │ │ ├── seal_2.png │ │ │ └── Contents.json │ │ ├── seal_3.imageset │ │ │ ├── seal_3.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── ContentView.swift │ ├── Views │ │ ├── iOS14 │ │ │ ├── TextEditorSample.swift │ │ │ ├── LabelSample.swift │ │ │ ├── ProgressViewSample.swift │ │ │ ├── ContainerRelativeShapeSample.swift │ │ │ ├── LinkSample.swift │ │ │ ├── MapViewSample.swift │ │ │ ├── LazyVStackSample.swift │ │ │ └── GridSample.swift │ │ ├── NavigationLinkSample.swift │ │ ├── RectangleSample.swift │ │ ├── SheetSample.swift │ │ ├── PathSample.swift │ │ ├── ListSample.swift │ │ ├── SpacerSample.swift │ │ ├── TextFieldSample.swift │ │ ├── ImageSample.swift │ │ ├── TabViewSample.swift │ │ ├── ActionSheetSample.swift │ │ ├── ScrollViewSample.swift │ │ └── AlertSample.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── BasicViews.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── BasicViewsTests │ ├── Info.plist │ └── BasicViewsTests.swift └── BasicViewsUITests │ ├── Info.plist │ └── BasicViewsUITests.swift ├── FilterSample ├── FilterSample │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── snap.imageset │ │ │ ├── snap.png │ │ │ └── Contents.json │ │ ├── photo_icon.imageset │ │ │ ├── photo_icon.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── SceneDelegate.swift │ ├── Content │ │ ├── CustomToolBar │ │ │ └── CustomToolBar.swift │ │ └── ImagePicker │ │ │ └── ImagePicker.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── FilterSampleTests │ ├── Info.plist │ └── CameraSampleTests.swift ├── FilterSampleUITests │ ├── Info.plist │ └── CameraSampleUITests.swift └── FilterSample.xcodeproj │ └── xcuserdata │ └── satoutakeshi.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── GitHubApiClientSample ├── images │ ├── image1.png │ └── image2.png ├── GitHubApiClientSample │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ ├── Contents.json │ │ │ └── rocket.imageset │ │ │ ├── rocket.png │ │ │ └── Contents.json │ ├── Models │ │ ├── Owner.swift │ │ ├── SearchRepositoryResponse.swift │ │ └── Repository.swift │ ├── Service │ │ ├── APIServiceError.swift │ │ ├── SearchRepositoryRequest.swift │ │ └── APIService.swift │ ├── ViewConpoments │ │ └── SafariView.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── GitHubApiClientSample.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── README.md ├── GitHubApiClientSampleTests │ ├── Info.plist │ ├── GitHubApiClientSampleTests.swift │ ├── MockAPIService.swift │ └── HomeViewModelTests.swift └── GitHubApiClientSampleUITests │ ├── Info.plist │ └── GitHubApiClientSampleUITests.swift ├── SwiftUIOverview ├── SwiftUIOverview │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── wing.imageset │ │ │ ├── wing.png │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── ImageViewController.swift │ ├── Info.plist │ └── ContentView.swift ├── SwiftUIOverview.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── SwiftUIOverviewTests │ ├── Info.plist │ └── SwiftUIOverviewTests.swift └── SwiftUIOverviewUITests │ ├── Info.plist │ └── SwiftUIOverviewUITests.swift ├── TodoReminder ├── TodoReminder │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── 20.png │ │ │ ├── 29.png │ │ │ ├── 40.png │ │ │ ├── 48.png │ │ │ ├── 50.png │ │ │ ├── 55.png │ │ │ ├── 57.png │ │ │ ├── 58.png │ │ │ ├── 60.png │ │ │ ├── 72.png │ │ │ ├── 76.png │ │ │ ├── 80.png │ │ │ ├── 87.png │ │ │ ├── 88.png │ │ │ ├── 100.png │ │ │ ├── 1024.png │ │ │ ├── 114.png │ │ │ ├── 120.png │ │ │ ├── 144.png │ │ │ ├── 152.png │ │ │ ├── 167.png │ │ │ ├── 172.png │ │ │ ├── 180.png │ │ │ ├── 196.png │ │ │ └── 216.png │ │ └── AccentColor.colorset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── TodoReminder.entitlements │ ├── App │ │ └── TodoReminderApp.swift │ ├── Model │ │ └── Todo.xcdatamodeld │ │ │ └── Todo.xcdatamodel │ │ │ └── contents │ ├── Views │ │ ├── TodoDetail │ │ │ └── TodoDetailView.swift │ │ ├── TodoList │ │ │ └── TodoListViewModel.swift │ │ └── AddTodo │ │ │ └── AddTodoView.swift │ └── Info.plist ├── TodoWidget │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ ├── WidgetBackground.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── TodoWidgetBundle.swift │ ├── DateListView.swift │ ├── TodoSingleView.swift │ ├── TodoWidgetType.swift │ └── Info.plist ├── TodoWidgetExtension.entitlements ├── TodoReminder.xcodeproj │ └── xcuserdata │ │ ├── t-sato.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── TodoReminderTests │ ├── TodoListViewModelTests.swift │ ├── Info.plist │ └── TodoReminderTests.swift └── TodoReminderUITests │ ├── Info.plist │ └── TodoReminderUITests.swift ├── AppSceneSample ├── AppSceneSample │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── seal_1.imageset │ │ │ ├── seal_1.png │ │ │ └── Contents.json │ │ ├── seal_2.imageset │ │ │ ├── seal_2.png │ │ │ └── Contents.json │ │ ├── seal_3.imageset │ │ │ ├── seal_3.png │ │ │ └── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── ContentView.swift │ ├── AppSceneSampleApp.swift │ └── Info.plist ├── AppSceneSample.xcodeproj │ └── xcuserdata │ │ └── t-sato.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── AppSceneSampleTests │ ├── Info.plist │ └── AppSceneSampleTests.swift └── AppSceneSampleUITests │ ├── Info.plist │ └── AppSceneSampleUITests.swift ├── DataFlowSample ├── DataFlowSample │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AccentColor.colorset │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── DataFlowSampleApp.swift │ ├── EnvironmentSample.swift │ ├── StorageSampleView.swift │ ├── EnvironmentObjectSample.swift │ ├── Info.plist │ └── ObjectLifecycle.swift ├── DataFlowSample.xcodeproj │ └── xcuserdata │ │ └── satoutakeshi.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── DataFlowSampleTests │ ├── Info.plist │ └── DataFlowSampleTests.swift └── DataFlowSampleUITests │ ├── Info.plist │ └── DataFlowSampleUITests.swift ├── GeometryReaderSample ├── GeometryReaderSample │ ├── Assets.xcassets │ │ ├── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Preview Content │ │ └── Preview Assets.xcassets │ │ │ └── Contents.json │ ├── ScrollRectangle.swift │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── ResearchGeometry.swift │ └── Info.plist └── GeometryReaderSample.xcodeproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ └── satoutakeshi.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── DataFlowSample.playground ├── Pages │ ├── @StateSample.xcplaygroundpage │ │ ├── timeline.xctimeline │ │ └── Contents.swift │ ├── @StateObjectSample.xcplaygroundpage │ │ ├── timeline.xctimeline │ │ └── Contents.swift │ ├── ToggleView.xcplaygroundpage │ │ └── Contents.swift │ ├── PropertySample.xcplaygroundpage │ │ └── Contents.swift │ ├── @Binding.xcplaygroundpage │ │ └── Contents.swift │ ├── @ObservedObjectSample.xcplaygroundpage │ │ └── Contents.swift │ └── @ObservedObjectLifecycle.xcplaygroundpage │ │ └── Contents.swift ├── contents.xcplayground └── xcuserdata │ └── satoutakeshi.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── CombineIntroduce └── CombineIntroduce.playground │ ├── contents.xcplayground │ └── Pages │ ├── URLSession.xcplaygroundpage │ └── Contents.swift │ └── Subjects.xcplaygroundpage │ └── Contents.swift └── LICENSE.md /DrawingApp/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/DrawingApp/images/image1.png -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /GitHubApiClientSample/images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/GitHubApiClientSample/images/image1.png -------------------------------------------------------------------------------- /GitHubApiClientSample/images/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/GitHubApiClientSample/images/image2.png -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /FilterSample/FilterSample/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/wing.imageset/wing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/BasicViews/BasicViews/Assets.xcassets/wing.imageset/wing.png -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_1.imageset/seal_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/BasicViews/BasicViews/Assets.xcassets/seal_1.imageset/seal_1.png -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_2.imageset/seal_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/BasicViews/BasicViews/Assets.xcassets/seal_2.imageset/seal_2.png -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_3.imageset/seal_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/BasicViews/BasicViews/Assets.xcassets/seal_3.imageset/seal_3.png -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/snap.imageset/snap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/FilterSample/FilterSample/Assets.xcassets/snap.imageset/snap.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/20.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/48.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/50.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/55.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/57.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/72.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/76.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/88.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/88.png -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Assets.xcassets/wing.imageset/wing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/SwiftUIOverview/SwiftUIOverview/Assets.xcassets/wing.imageset/wing.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/100.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/114.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/144.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/152.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/167.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/172.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/172.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/196.png -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/216.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/TodoReminder/TodoReminder/Assets.xcassets/AppIcon.appiconset/216.png -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_1.imageset/seal_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/AppSceneSample/AppSceneSample/Assets.xcassets/seal_1.imageset/seal_1.png -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_2.imageset/seal_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/AppSceneSample/AppSceneSample/Assets.xcassets/seal_2.imageset/seal_2.png -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_3.imageset/seal_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/AppSceneSample/AppSceneSample/Assets.xcassets/seal_3.imageset/seal_3.png -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/photo_icon.imageset/photo_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/FilterSample/FilterSample/Assets.xcassets/photo_icon.imageset/photo_icon.png -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@StateSample.xcplaygroundpage/timeline.xctimeline: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@StateObjectSample.xcplaygroundpage/timeline.xctimeline: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/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 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/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 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/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 | -------------------------------------------------------------------------------- /BasicViews/BasicViews.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/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 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Preview Content/Preview Assets.xcassets/rocket.imageset/rocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoTakeshiX/SwiftUICatalog/HEAD/GitHubApiClientSample/GitHubApiClientSample/Preview Content/Preview Assets.xcassets/rocket.imageset/rocket.png -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CombineIntroduce/CombineIntroduce.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BasicViews/BasicViews.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Models/Owner.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Owner.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Owner: Decodable, Hashable, Identifiable { 12 | let id: Int 13 | let avatarUrl: String 14 | } 15 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/TodoWidgetBundle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoWidgetBundle.swift 3 | // TodoWidgetExtension 4 | // 5 | // Created by satoutakeshi on 2020/10/04. 6 | // 7 | 8 | import WidgetKit 9 | import SwiftUI 10 | 11 | @main 12 | struct TodoWidgetBundle: WidgetBundle { 13 | var body: some Widget { 14 | TodoWidget() 15 | PriorityWidget() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Models/SearchRepositoryResponse.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SearchRepositoryResponse.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct SearchRepositoryResponse: Decodable { 12 | let items: [Repository] 13 | } 14 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidgetExtension.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.personal-factory.todo-reminder 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/TodoReminder.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.application-groups 6 | 7 | group.com.personal-factory.todo-reminder 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Service/APIServiceError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // APIServiceError.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum APIServiceError: Error { 12 | case invalidURL 13 | case responseError 14 | case parseError(Error) 15 | } 16 | -------------------------------------------------------------------------------- /DrawingApp/README.md: -------------------------------------------------------------------------------- 1 | # DrawingApp 2 | 3 | 続いてお絵かきアプリです。 4 | 画面を指でなぞって絵が描けます。 5 | 描いたキャンバスは保存ボタンを押せば、標準の写真アプリに画像として保存できます。 6 | 「消しゴム」ボタンをタップすれば描いた線をなぞって消すことができます。 7 | 8 | このアプリを通して次の実装が学べます。 9 | 10 | * DragGestureの使い方 11 | * ジェスチャーの座標情報からPathのViewを作る方法 12 | * SwiftUIでViewのキャプチャを取る方法 13 | 14 | # キャプチャ 15 | 16 | ![DrawingApp](https://github.com/SatoTakeshiX/SwiftUICatalog/blob/master/DrawingApp/images/image1.png) 17 | 18 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/DataFlowSampleApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataFlowSampleApp.swift 3 | // DataFlowSample 4 | // 5 | // Created by satoutakeshi on 2020/09/17. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct DataFlowSampleApp: App { 12 | @StateObject private var dataSource = DataSource() 13 | var body: some Scene { 14 | WindowGroup { 15 | StorageSampleView() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/wing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "wing.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_1.png", 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 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_2.png", 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 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/seal_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_3.png", 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 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/snap.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "snap.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 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Assets.xcassets/wing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "wing.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_1.png", 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 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_2.png", 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 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/Assets.xcassets/seal_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "seal_3.png", 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 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/photo_icon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "photo_icon.png", 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 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/DateListView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DateListView.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct DateListView: View { 11 | var body: some View { 12 | Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) 13 | } 14 | } 15 | 16 | struct DateListView_Previews: PreviewProvider { 17 | static var previews: some View { 18 | DateListView() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | Text("Hello, World!") 14 | } 15 | } 16 | 17 | struct ContentView_Previews: PreviewProvider { 18 | static var previews: some View { 19 | ContentView() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // DrawingApp 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | Text("Hello, World!") 14 | } 15 | } 16 | 17 | struct ContentView_Previews: PreviewProvider { 18 | static var previews: some View { 19 | ContentView() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/TodoSingleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoSingleView.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/16. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TodoSingleView: View { 11 | var body: some View { 12 | Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) 13 | } 14 | } 15 | 16 | struct TodoSingleView_Previews: PreviewProvider { 17 | static var previews: some View { 18 | TodoSingleView() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawingApp.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Preview Content/Preview Assets.xcassets/rocket.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "rocket.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample.xcodeproj/xcuserdata/t-sato.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AppSceneSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DataFlowSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftUIOverview.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DataFlowSample.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GeometryReaderSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GitHubApiClientSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DataFlowSample.playground/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DataFlowSample (Playground).xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Models/Repository.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Repository.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Repository: Decodable, Hashable, Identifiable { 12 | let id: Int 13 | let name: String 14 | let description: String? 15 | let stargazersCount: Int 16 | let language: String? 17 | let htmlUrl: String 18 | let owner: Owner 19 | } 20 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/ToggleView.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | struct ToggleView: View { 7 | @State private var isOn = false 8 | var body: some View { 9 | VStack { 10 | Toggle("switch isOn", isOn: $isOn) 11 | Text("\(isOn ? "On" : "Off")") 12 | } 13 | } 14 | } 15 | PlaygroundPage.current.setLiveView(ToggleView() 16 | .frame(width: 500, height: 200).padding()) 17 | 18 | //: [Next](@next) 19 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@StateSample.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | struct ParentView: View { 7 | @State private var counter = 0 8 | var body: some View { 9 | Button(action: { 10 | counter += 1 11 | }, label: { 12 | Text("counter is \(counter)") 13 | }) 14 | } 15 | } 16 | 17 | PlaygroundPage.current.setLiveView(ParentView() 18 | .frame(width: 200, height: 100).padding()) 19 | 20 | 21 | //: [Next](@next) 22 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder.xcodeproj/xcuserdata/t-sato.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TodoReminder.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | TodoWidgetExtension.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | TodoReminder.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | TodoWidgetExtension.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Model/DrawPoints.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawPoints.swift 3 | // DrawingApp 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct DrawPoints: Identifiable { 12 | var points: [CGPoint] 13 | var color: Color 14 | var id = UUID() 15 | } 16 | 17 | enum DrawColor { 18 | case red 19 | case clear 20 | 21 | var color: Color { 22 | switch self { 23 | case .red: 24 | return Color.red 25 | case .clear: 26 | return Color.white 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/TextEditorSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextEditorSample.swift 3 | // BasicViews 4 | // 5 | // Created by t-sato on 2020/09/09. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct TextEditorSample: View { 13 | @State private var text = "" 14 | var body: some View { 15 | TextEditor(text: $text) 16 | .foregroundColor(Color.red) 17 | } 18 | } 19 | 20 | @available(iOS 14.0, *) 21 | struct TextEditorSample_Previews: PreviewProvider { 22 | static var previews: some View { 23 | TextEditorSample() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/App/TodoReminderApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoReminderApp.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import SwiftUI 9 | import WidgetKit 10 | 11 | @main 12 | struct TodoReminderApp: App { 13 | @Environment(\.scenePhase) private var scenePhase 14 | var body: some Scene { 15 | WindowGroup { 16 | TodoListView() 17 | .onChange(of: scenePhase) { newScenePhase in 18 | if newScenePhase == .active { 19 | WidgetCenter.shared.reloadTimelines(ofKind: "TodoWidget") 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /GitHubApiClientSample/README.md: -------------------------------------------------------------------------------- 1 | # GitHubApiClientSample 2 | 3 | GitHubAPIを使ってリポジトリ検索ができるアプリです。 4 | `TextField`に入力した文字でリポジトリを検索し、画面に表示します。 5 | 検索中は「読込中」の文字が表示されます。 6 | ボタンタップでそのリポジトリのWebページを表示できるようにします。 7 | 8 | このサンプルアプリでは次のことが学べます。 9 | 10 | * `URLSession`を使ったネットーワーク通信 11 | * APIのレスポンスJSONからUIを作る方法 12 | * カード型UI 13 | * `TextField}`によるユーザーの入力に合わせた処理方法 14 | * SwiftUIからWebページの表示 15 | 16 | かなり実践的なアプリになるので、皆さんが作るアプリにも応用が効くでしょう。 17 | 18 | # キャプチャ 19 | 20 | ![DrawingApp](https://github.com/SatoTakeshiX/SwiftUICatalog/blob/master/GitHubApiClientSample/images/image1.png) 21 | 22 | ![DrawingApp](https://github.com/SatoTakeshiX/SwiftUICatalog/blob/master/GitHubApiClientSample/images/image2.png) 23 | 24 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/EnvironmentSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // EnvironmentSample.swift 3 | // DataFlowSample 4 | // 5 | // Created by satoutakeshi on 2020/09/21. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct EnvironmentSample: View { 11 | @Environment(\.colorScheme) var colorScheme: ColorScheme 12 | var body: some View { 13 | if colorScheme == .dark { 14 | Text("dark mode") 15 | } else if colorScheme == .light { 16 | Text("light mode") 17 | } else { 18 | Text("") 19 | } 20 | } 21 | } 22 | 23 | struct EnvironmentSample_Previews: PreviewProvider { 24 | static var previews: some View { 25 | EnvironmentSample() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/LabelSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LabelSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/09/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct LabelSample: View { 13 | var body: some View { 14 | List { 15 | Label("sun", systemImage: "sun.max.fill") 16 | Label("cloud", systemImage: "cloud") 17 | Label("rain", systemImage: "cloud.rain.fill") 18 | } 19 | } 20 | } 21 | 22 | @available(iOS 14.0, *) 23 | struct LabelSample_Previews: PreviewProvider { 24 | static var previews: some View { 25 | LabelSample() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/NavigationLinkSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationViewSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct NavigationLinkSample: View { 12 | var body: some View { 13 | NavigationLink(destination: Text("navigation")) { 14 | Text("NavigationViewSample") 15 | .navigationBarTitle(Text("NavigationLinkSample")) 16 | } 17 | } 18 | } 19 | 20 | struct NavigationViewSample_Previews: PreviewProvider { 21 | static var previews: some View { 22 | NavigationView { 23 | NavigationLinkSample() 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/PropertySample.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | struct ParentView: View { 6 | let title = "title" 7 | var body: some View { 8 | HStack { 9 | ChildView(color: .blue) 10 | ChildView(color: .yellow) 11 | ChildView(color: .red) 12 | Text(title) 13 | } 14 | } 15 | } 16 | 17 | struct ChildView: View { 18 | let color: Color 19 | var body: some View { 20 | Circle().foregroundColor(color) 21 | } 22 | } 23 | 24 | PlaygroundPage.current.setLiveView(ParentView() 25 | .frame(width: 600, height: 400).padding()) 26 | 27 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/RectangleSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RoundedRectangleSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct RectangleSample: View { 12 | var body: some View { 13 | NavigationView { 14 | Rectangle() 15 | .foregroundColor(.gray) 16 | .frame(width: 100, height: 100) 17 | .navigationBarTitle("RoundedRectangle", displayMode: .inline) 18 | 19 | } 20 | } 21 | } 22 | 23 | struct RoundedRectangleSample_Previews: PreviewProvider { 24 | static var previews: some View { 25 | RectangleSample() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/ProgressViewSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressViewSample.swift 3 | // BasicViews 4 | // 5 | // Created by t-sato on 2020/09/09. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct ProgressViewSample: View { 13 | var body: some View { 14 | ScrollView { 15 | ProgressView("Downloading…") 16 | .padding() 17 | ProgressView("Downloading…", value: 30, total: 100) 18 | .padding() 19 | 20 | } 21 | } 22 | } 23 | 24 | @available(iOS 14.0, *) 25 | struct ProgressViewSample_Previews: PreviewProvider { 26 | static var previews: some View { 27 | ProgressViewSample() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Service/SearchRepositoryRequest.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SearchRepositoryRequest.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct SearchRepositoryRequest: APIRequestType { 12 | typealias Response = SearchRepositoryResponse 13 | 14 | var path: String { return "/search/repositories" } 15 | var queryItems: [URLQueryItem]? { 16 | return [ 17 | .init(name: "q", value: query), 18 | .init(name: "order", value: "desc") 19 | ] 20 | } 21 | 22 | private let query: String 23 | 24 | init(query: String) { 25 | self.query = query 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/ViewConpoments/SafariView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SafariView.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/02/01. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import SafariServices 11 | 12 | struct SafariView: UIViewControllerRepresentable { 13 | typealias UIViewControllerType = SFSafariViewController 14 | let url: URL 15 | 16 | func makeUIViewController(context: UIViewControllerRepresentableContext) -> SFSafariViewController { 17 | return SFSafariViewController(url: url) 18 | } 19 | 20 | func updateUIViewController(_ uiViewController: SFSafariViewController, context: UIViewControllerRepresentableContext) {} 21 | } 22 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/StorageSampleView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StorageSampleView.swift 3 | // DataFlowSample 4 | // 5 | // Created by satoutakeshi on 2020/09/19. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct StorageSampleView: View { 11 | @SceneStorage("userName") private var userName: String = "" 12 | @AppStorage("isLogin") private var isLogin = false 13 | @State private var memo: String = "" 14 | var body: some View { 15 | List { 16 | TextField("Input your name", text: $userName) 17 | Toggle("Login", isOn: $isLogin) 18 | TextField("Input memo", text: $memo) 19 | } 20 | } 21 | } 22 | 23 | struct StorageSampleView_Previews: PreviewProvider { 24 | static var previews: some View { 25 | StorageSampleView() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminderTests/TodoListViewModelTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoListViewModelTests.swift 3 | // TodoReminderTests 4 | // 5 | // Created by satoutakeshi on 2020/10/03. 6 | // 7 | 8 | import XCTest 9 | @testable import TodoReminder 10 | 11 | class TodoListViewModelTests: XCTestCase { 12 | func testGetId() { 13 | let viewModel = TodoListViewModel() 14 | XCTContext.runActivity(named: "url") { _ in 15 | let url = URL(string: "todolist://detail?id=E621E1F8-C36C-495A-93FC-0C247A3E6E5F")! 16 | if let id = viewModel.getWidgetTodoItemID(from: url) { 17 | XCTAssertEqual(id, UUID(uuidString: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")!) 18 | } else { 19 | XCTFail("id is nil") 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // CameraSample 4 | // 5 | // Created by satoutakeshi on 2019/12/21. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | var window: UIWindow? 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | if let windowScene = scene as? UIWindowScene { 17 | let window = UIWindow(windowScene: windowScene) 18 | window.rootViewController = UIHostingController(rootView: FilterContentView()) 19 | self.window = window 20 | window.makeKeyAndVisible() 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@Binding.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | struct ParentView: View { 7 | @State var counter = 0 8 | var body: some View { 9 | ChildView(counter: $counter) 10 | .frame(width: .infinity) 11 | } 12 | } 13 | struct ChildView: View { 14 | @Binding var counter: Int 15 | var body: some View { 16 | Button(action: { 17 | counter += 1 18 | }, label: { 19 | Text("\(counter)") 20 | .font(.title) 21 | }) 22 | .border(Color.red) 23 | } 24 | } 25 | 26 | PlaygroundPage.current.setLiveView(ParentView() 27 | .frame(width: 200, height: 100).padding()) 28 | 29 | 30 | //: [Next](@next) 31 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/UIView+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Extension.swift 3 | // DrawingApp 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIView { 12 | var renderedImage: UIImage { 13 | // rect of capure 14 | let rect = self.bounds 15 | // create the context of bitmap 16 | UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0) 17 | let context: CGContext = UIGraphicsGetCurrentContext()! 18 | self.layer.render(in: context) 19 | // get a image from current context bitmap 20 | let capturedImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()! 21 | UIGraphicsEndImageContext() 22 | return capturedImage 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BasicViews/BasicViewsTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /BasicViews/BasicViewsUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /DrawingApp/DrawingAppTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /DrawingApp/DrawingAppUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSampleTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSampleTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /FilterSample/FilterSampleTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /FilterSample/FilterSampleUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminderTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminderUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSampleUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSampleUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverviewTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverviewUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleTests/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 | 22 | 23 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleUITests/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 | 22 | 23 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // AppSceneSample 4 | // 5 | // Created by t-sato on 2020/09/12. 6 | // 7 | 8 | import SwiftUI 9 | let adaptiveColums = [ 10 | GridItem(.adaptive(minimum: 100), spacing: 0) 11 | ] 12 | 13 | struct ContentView: View { 14 | let colums: [GridItem] 15 | var body: some View { 16 | ScrollView { 17 | LazyVGrid(columns: colums, spacing: 0) { 18 | ForEach(0 ..< 100) { _ in 19 | Image("seal_\(Int.random(in: 1 ... 3))") 20 | .resizable() 21 | .aspectRatio(contentMode: .fit) 22 | } 23 | } 24 | } 25 | } 26 | } 27 | 28 | struct ContentView_Previews: PreviewProvider { 29 | static var previews: some View { 30 | ContentView(colums: adaptiveColums) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BasicViews/BasicViews.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BasicViews.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 3099B74623F0E1C20060553A 16 | 17 | primary 18 | 19 | 20 | 3099B75C23F0E1C40060553A 21 | 22 | primary 23 | 24 | 25 | 3099B76723F0E1C40060553A 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /FilterSample/FilterSample.xcodeproj/xcuserdata/satoutakeshi.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FilterSample.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 306830E223AE612C0070F473 16 | 17 | primary 18 | 19 | 20 | 306830F823AE612F0070F473 21 | 22 | primary 23 | 24 | 25 | 3068310323AE612F0070F473 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/EnvironmentObjectSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // DataFlowSample 4 | // 5 | // Created by satoutakeshi on 2020/09/17. 6 | // 7 | 8 | import SwiftUI 9 | 10 | class DataSource: ObservableObject { 11 | @Published var counter = 0 12 | } 13 | 14 | struct ParentView: View { 15 | var body: some View { 16 | ChildView() 17 | } 18 | } 19 | 20 | struct ChildView: View { 21 | var body: some View { 22 | GrandChildView() 23 | } 24 | } 25 | 26 | struct GrandChildView: View { 27 | @EnvironmentObject var dataSource: DataSource 28 | var body: some View { 29 | Text("\(dataSource.counter)") 30 | } 31 | } 32 | 33 | struct DataFlowSampleApp_Previews: PreviewProvider { 34 | @StateObject static private var dataSource = DataSource() 35 | static var previews: some View { 36 | ParentView().environmentObject(dataSource) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@ObservedObjectSample.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | final class DataSource: ObservableObject { 7 | @Published var counter = 0 8 | } 9 | 10 | struct ParentView: View { 11 | @StateObject private var dataSource = DataSource() 12 | var body: some View { 13 | ChildView(dataSource: dataSource) 14 | } 15 | } 16 | 17 | struct ChildView: View { 18 | @ObservedObject var dataSource: DataSource 19 | var body: some View { 20 | VStack { 21 | Button("increment counter") { 22 | dataSource.counter += 1 23 | } 24 | Text("count: \(dataSource.counter)") 25 | } 26 | } 27 | } 28 | 29 | PlaygroundPage.current.setLiveView(ParentView() 30 | .frame(width: 500, height: 200).padding()) 31 | 32 | 33 | //: [Next](@next) 34 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/AppSceneSampleApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppSceneSampleApp.swift 3 | // AppSceneSample 4 | // 5 | // Created by t-sato on 2020/09/12. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct MyApp: App { 12 | @Environment(\.scenePhase) private var scenePhase 13 | var body: some Scene { 14 | WindowGroup { 15 | ContentView(colums: adaptiveColums) 16 | .onChange(of: scenePhase) { newScenePhase in 17 | switch newScenePhase { 18 | case .background: 19 | print("do something when background") 20 | case .inactive: 21 | print("do something when inactive") 22 | case .active: 23 | print("do something when active") 24 | @unknown default: 25 | fatalError() 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/ContainerRelativeShapeSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContainerRelativeShapeSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/09/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct ContainerRelativeShapeSample: View { 13 | var body: some View { 14 | VStack { 15 | Image(systemName: "camera") 16 | .resizable() 17 | .clipShape(ContainerRelativeShape()) 18 | Text("title") 19 | .background(ContainerRelativeShape().fill(Color.red)) 20 | } 21 | //ContainerRelativeShape 22 | } 23 | } 24 | 25 | @available(iOS 14.0, *) 26 | struct ContainerRelativeShapeSample_Previews: PreviewProvider { 27 | static var previews: some View { 28 | ContainerRelativeShapeSample() 29 | // .previewContext(WidgetPreviewContext(family: .systemSmall)) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/SheetSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SheetSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct SheetSample: View { 12 | @State private var isShowSheet: Bool = false 13 | var body: some View { 14 | Button(action: { 15 | isShowSheet = true 16 | }) { 17 | Image(systemName: "photo.on.rectangle") 18 | .resizable() 19 | .aspectRatio(contentMode: .fit) 20 | .frame(width: 60, height: 60) 21 | } 22 | .sheet(isPresented: $isShowSheet) { 23 | Button(action: { 24 | isShowSheet = false 25 | }) { 26 | Text("Dismiss") 27 | } 28 | } 29 | } 30 | } 31 | 32 | struct SheetSample_Previews: PreviewProvider { 33 | static var previews: some View { 34 | SheetSample() 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/LinkSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LinkSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/09/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct LinkSample: View { 13 | @Environment(\.openURL) private var openURL 14 | let googleURL = URL(string: "https://google.com")! 15 | var body: some View { 16 | List { 17 | Link("google", destination: googleURL) 18 | Link(destination: googleURL) { 19 | Label("google", systemImage: "link") 20 | } 21 | Button(action: { 22 | openURL(googleURL) 23 | }, label: { 24 | Text("google with button") 25 | }) 26 | } 27 | } 28 | } 29 | 30 | @available(iOS 14.0, *) 31 | struct LinkSample_Previews: PreviewProvider { 32 | static var previews: some View { 33 | LinkSample() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Content/CustomToolBar/CustomToolBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CustomToolBar.swift 3 | // CameraSample 4 | // 5 | // Created by satoutakeshi on 2020/07/08. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct CustomToolBar: View { 12 | var body: some View { 13 | VStack { 14 | Spacer() 15 | Rectangle() 16 | .frame(width: UIScreen.main.bounds.width, height: 112) 17 | .foregroundColor(.gray) 18 | .opacity(0.3) 19 | .overlay(Path { path in 20 | path.move(to: CGPoint(x: 0, y: 0)) 21 | path.addLine(to: CGPoint(x: UIScreen.main.bounds.maxX, y: 0)) 22 | }.stroke(lineWidth: 1) 23 | .fill(Color.gray)) 24 | } 25 | } 26 | } 27 | 28 | struct CustomToolBar_Previews: PreviewProvider { 29 | static var previews: some View { 30 | CustomToolBar() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/MapViewSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MapViewSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/09/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import MapKit 11 | 12 | //https://swiftwithmajid.com/2020/07/29/using-mapkit-with-swiftui/ 13 | 14 | @available(iOS 14.0, *) 15 | struct MapViewSample: View { 16 | @State private var region = MKCoordinateRegion( 17 | center: CLLocationCoordinate2D( 18 | latitude: 35.6593912, 19 | longitude: 139.7003861 20 | ), 21 | span: MKCoordinateSpan( 22 | latitudeDelta: 0.01, 23 | longitudeDelta: 0.01 24 | ) 25 | ) 26 | 27 | var body: some View { 28 | Map(coordinateRegion: $region) 29 | .edgesIgnoringSafeArea(.all) 30 | } 31 | } 32 | 33 | @available(iOS 14.0, *) 34 | struct MapViewSample_Previews: PreviewProvider { 35 | static var previews: some View { 36 | MapViewSample() 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Model/Todo.xcdatamodeld/Todo.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/TodoWidgetType.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoWidgetType.swift 3 | // TodoWidgetExtension 4 | // 5 | // Created by satoutakeshi on 2020/10/04. 6 | // 7 | 8 | import SwiftUI 9 | 10 | protocol TodoWidgetType { 11 | func makePriorityColor(priority: TodoPriority) -> Color 12 | func makeURLScheme(id: UUID) -> URL? 13 | } 14 | 15 | extension TodoWidgetType where Self: View { 16 | func makePriorityColor(priority: TodoPriority) -> Color { 17 | switch priority { 18 | case .high: 19 | return .red 20 | case .medium: 21 | return .yellow 22 | case .low: 23 | return .green 24 | } 25 | } 26 | 27 | func makeURLScheme(id: UUID) -> URL? { 28 | guard let url = URL(string: "todolist://detail") else { 29 | return nil 30 | } 31 | var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: true) 32 | urlComponents?.queryItems = [URLQueryItem(name: "id", value: id.uuidString)] 33 | return urlComponents?.url 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /BasicViews/BasicViewsTests/BasicViewsTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BasicViewsTests.swift 3 | // BasicViewsTests 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import BasicViews 11 | 12 | class BasicViewsTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /DrawingApp/DrawingAppTests/DrawingAppTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawingAppTests.swift 3 | // DrawingAppTests 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import DrawingApp 11 | 12 | class DrawingAppTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/ScrollRectangle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollRectangle.swift 3 | // GeometryReaderSample 4 | // 5 | // Created by satoutakeshi on 2019/12/15. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ScrollRectangle: View { 12 | var body: some View { 13 | ScrollView { 14 | VStack { 15 | GeometryReader { geometry in 16 | RoundedRectangle(cornerRadius: 20) 17 | .fill(Color.pink) 18 | .overlay( 19 | Text("Y: \(Int(geometry.frame(in: .global).origin.y))") 20 | .foregroundColor(.white) 21 | .fontWeight(.heavy)) 22 | .font(.largeTitle) 23 | }.frame(height: 100) 24 | Spacer() 25 | } 26 | } 27 | } 28 | } 29 | 30 | struct ScrollRectangle_Previews: PreviewProvider { 31 | static var previews: some View { 32 | ScrollRectangle() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminderTests/TodoReminderTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoReminderTests.swift 3 | // TodoReminderTests 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import XCTest 9 | @testable import TodoReminder 10 | 11 | class TodoReminderTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSampleTests/AppSceneSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppSceneSampleTests.swift 3 | // AppSceneSampleTests 4 | // 5 | // Created by t-sato on 2020/09/12. 6 | // 7 | 8 | import XCTest 9 | @testable import AppSceneSample 10 | 11 | class AppSceneSampleTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSampleTests/DataFlowSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataFlowSampleTests.swift 3 | // DataFlowSampleTests 4 | // 5 | // Created by satoutakeshi on 2020/09/17. 6 | // 7 | 8 | import XCTest 9 | @testable import DataFlowSample 10 | 11 | class DataFlowSampleTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /FilterSample/FilterSampleTests/CameraSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CameraSampleTests.swift 3 | // CameraSampleTests 4 | // 5 | // Created by satoutakeshi on 2019/12/21. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import CameraSample 11 | 12 | class CameraSampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverviewTests/SwiftUIOverviewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUIOverviewTests.swift 3 | // SwiftUIOverviewTests 4 | // 5 | // Created by satoutakeshi on 2020/02/03. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import SwiftUIOverview 11 | 12 | class SwiftUIOverviewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Sato Takeshi 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleTests/GitHubApiClientSampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GitHubApiClientSampleTests.swift 3 | // GitHubApiClientSampleTests 4 | // 5 | // Created by satoutakeshi on 2020/01/27. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import GitHubApiClientSample 11 | 12 | class GitHubApiClientSampleTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/PathSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PathSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct PathSample: View { 12 | var body: some View { 13 | VStack { 14 | Path { path in 15 | path.addLines([CGPoint(x: 0, y: 0), 16 | CGPoint(x: UIScreen.main.bounds.width, y: 0), 17 | CGPoint(x: UIScreen.main.bounds.width/2, y: UIScreen.main.bounds.height/3), 18 | CGPoint(x: 0, y: 0)]) 19 | } 20 | .stroke(Color.red, lineWidth: 4) 21 | Path { path in 22 | path.addRect(CGRect(x: (UIScreen.main.bounds.width - 100)/2, 23 | y: 0, 24 | width: 100, 25 | height: 100)) 26 | 27 | } 28 | .fill(Color.red) 29 | } 30 | } 31 | } 32 | 33 | struct PathSample_Previews: PreviewProvider { 34 | static var previews: some View { 35 | PathSample() 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@StateObjectSample.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | final class DataSource: ObservableObject { 7 | @Published var counter = 0 8 | } 9 | 10 | struct CounterView: View { 11 | @StateObject private var dataSource = DataSource() 12 | var body: some View { 13 | VStack { 14 | Button("increment counter") { 15 | dataSource.counter += 1 16 | } 17 | Text("count: \(dataSource.counter)") 18 | } 19 | } 20 | } 21 | 22 | struct SwitchColorView: View { 23 | @State private var isDanger: Bool = false 24 | var body: some View { 25 | VStack { 26 | Button("Change the Color") { 27 | isDanger.toggle() 28 | } 29 | if isDanger { 30 | Circle().foregroundColor(.red) 31 | } else { 32 | Circle().foregroundColor(.green) 33 | } 34 | CounterView() 35 | } 36 | } 37 | } 38 | PlaygroundPage.current.setLiveView(SwitchColorView() 39 | .frame(width: 500, height: 200).padding()) 40 | //: [Next](@next) 41 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleTests/MockAPIService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MockAPIService.swift 3 | // GitHubApiClientSampleTests 4 | // 5 | // Created by satoutakeshi on 2020/02/01. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | @testable import GitHubApiClientSample 12 | 13 | final class MockAPIService: APIServiceType { 14 | var stubs: [Any] = [] 15 | 16 | typealias Request = APIRequestType 17 | 18 | func stub(for type: Request.Type, response: @escaping ((Request) -> AnyPublisher)) where Request: APIRequestType { 19 | stubs.append(response) 20 | } 21 | 22 | func request(with request: Request) -> AnyPublisher where Request: APIRequestType { 23 | 24 | let response = stubs.compactMap { stub -> AnyPublisher? in 25 | let stub = stub as? ((Request) -> AnyPublisher) 26 | return stub?(request) 27 | }.last 28 | 29 | return response ?? Empty() 30 | .eraseToAnyPublisher() 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DataFlowSample.playground/Pages/@ObservedObjectLifecycle.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import SwiftUI 4 | import PlaygroundSupport 5 | 6 | final class DataSource: ObservableObject { 7 | @Published var counter = 0 8 | } 9 | 10 | struct CounterView: View { 11 | @ObservedObject private var dataSource = DataSource() 12 | var body: some View { 13 | VStack { 14 | Button("increment counter") { 15 | dataSource.counter += 1 16 | } 17 | Text("count: \(dataSource.counter)") 18 | } 19 | } 20 | } 21 | 22 | struct SwitchColorView: View { 23 | @State private var isDanger: Bool = false 24 | var body: some View { 25 | VStack { 26 | Button("Change the Color") { 27 | isDanger.toggle() 28 | } 29 | if isDanger { 30 | Circle().foregroundColor(.red) 31 | } else { 32 | Circle().foregroundColor(.green) 33 | } 34 | CounterView() 35 | } 36 | } 37 | } 38 | PlaygroundPage.current.setLiveView(SwitchColorView() 39 | .frame(width: 500, height: 200).padding()) 40 | 41 | //: [Next](@next) 42 | -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | TodoWidget 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | NSExtension 24 | 25 | NSExtensionAttributes 26 | 27 | IntentsSupported 28 | 29 | DynamicPrioritySelectionIntent 30 | 31 | 32 | NSExtensionPointIdentifier 33 | com.apple.widgetkit-extension 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/ListSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ListSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/10/17. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ListSample: View { 12 | var body: some View { 13 | List { 14 | Section(header: Text("Weather"), footer: Text("footer")) { 15 | HStack { 16 | Image(systemName: "moon") 17 | Text("moon") 18 | } 19 | HStack { 20 | Image(systemName: "sun.max") 21 | Text("sun") 22 | } 23 | } 24 | Section(header: HStack{ 25 | Image(systemName: "hare") 26 | Text("Animal") 27 | }) { 28 | HStack { 29 | Image(systemName: "hare") 30 | Text("rabbit") 31 | } 32 | } 33 | Section { 34 | HStack { 35 | Image(systemName: "gamecontroller") 36 | Text("game") 37 | } 38 | } 39 | } 40 | } 41 | } 42 | 43 | struct ListSample_Previews: PreviewProvider { 44 | static var previews: some View { 45 | ListSample() 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/SpacerSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SpacerSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct SpacerSample: View { 12 | var body: some View { 13 | VStack { 14 | HStack { 15 | Image("wing") 16 | Spacer() 17 | Image("wing") 18 | } 19 | .onTapGesture { 20 | print("tapped") 21 | } 22 | 23 | Button(action: { 24 | print("tapped button") 25 | }){ 26 | HStack { 27 | Image("wing") 28 | .renderingMode(.original) 29 | Spacer() 30 | Image("wing") 31 | .renderingMode(.original) 32 | } 33 | } 34 | 35 | HStack { 36 | Image("wing") 37 | Spacer() 38 | Image("wing") 39 | } 40 | .contentShape(Rectangle()) 41 | .onTapGesture { 42 | print("tapped") 43 | } 44 | 45 | } 46 | 47 | } 48 | } 49 | 50 | struct SpacerSample_Previews: PreviewProvider { 51 | static var previews: some View { 52 | SpacerSample() 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/LazyVStackSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // LazyVStackSample.swift 3 | // BasicViews 4 | // 5 | // Created by t-sato on 2020/09/04. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | struct LazyVStackSample: View { 13 | var body: some View { 14 | ScrollView { 15 | LazyVStack { 16 | ForEach(0 ..< 100) { _ in 17 | Image("seal_\(Int.random(in: 1 ... 3))") 18 | .resizable() 19 | .aspectRatio(contentMode: .fit) 20 | } 21 | } 22 | } 23 | } 24 | } 25 | 26 | @available(iOS 14.0, *) 27 | struct LazyVStackSample_Previews: PreviewProvider { 28 | static var previews: some View { 29 | LazyVStackSample() 30 | } 31 | } 32 | 33 | struct VStackSample: View { 34 | var body: some View { 35 | ScrollView { 36 | VStack { 37 | ForEach(0 ..< 100) { _ in 38 | Image("seal_\(Int.random(in: 1 ... 3))") 39 | .resizable() 40 | .aspectRatio(contentMode: .fit) 41 | } 42 | } 43 | } 44 | } 45 | } 46 | 47 | struct VStackSample_Previews: PreviewProvider { 48 | static var previews: some View { 49 | VStackSample() 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/TextFieldSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TextFieldSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct TextFieldSample: View { 12 | @State private var inputTextOne: String = "" 13 | @State private var inputTextTwo: String = "" 14 | var body: some View { 15 | 16 | ScrollView { 17 | VStack { 18 | TextField("input search keyword", text: $inputTextOne, onEditingChanged: {_ in 19 | print("onEditingChanged") 20 | }, onCommit: { 21 | print("onCommit") 22 | }) 23 | .textFieldStyle(RoundedBorderTextFieldStyle()) 24 | .keyboardType(.asciiCapable) 25 | 26 | TextField("input numbers", text: $inputTextTwo, onEditingChanged: {_ in 27 | print("onEditingChanged") 28 | }, onCommit: { 29 | print("onCommit") 30 | }) 31 | .textFieldStyle(PlainTextFieldStyle()) 32 | .keyboardType(.decimalPad) 33 | } 34 | } 35 | .padding() 36 | } 37 | } 38 | 39 | struct TextFieldSample_Previews: PreviewProvider { 40 | static var previews: some View { 41 | TextFieldSample() 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CombineIntroduce/CombineIntroduce.playground/Pages/URLSession.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import Foundation 4 | import Combine 5 | import PlaygroundSupport 6 | 7 | PlaygroundPage.current.needsIndefiniteExecution = true 8 | 9 | struct APIError: Error { 10 | var description: String 11 | } 12 | 13 | let cancelable = URLSession.shared.dataTaskPublisher(for: 14 | URL(string: "https://api.github.com/search/repositories?q=swiftui")!) 15 | .tryMap { (data, response) -> Data in 16 | guard let response = response as? HTTPURLResponse else { 17 | throw APIError(description: "http response not found") 18 | } 19 | guard (200..<300).contains(response.statusCode) else { 20 | throw APIError(description: "status code is bad") 21 | } 22 | return data 23 | } 24 | .mapError({ (error) -> APIError in 25 | if let error = error as? APIError { 26 | return error 27 | } else { 28 | return APIError(description: error.localizedDescription) 29 | } 30 | }) 31 | .sink(receiveCompletion: { completion in 32 | switch completion { 33 | case .failure(let error): 34 | print(error) 35 | case .finished: 36 | print("finished") 37 | } 38 | }, receiveValue: { data in 39 | print(String(data: data, encoding: .utf8) ?? "") 40 | }) 41 | 42 | //: [Next](@next) 43 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CameraSample 4 | // 5 | // Created by satoutakeshi on 2019/12/21. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | // Override point for customization after application launch. 15 | return true 16 | } 17 | 18 | // MARK: UISceneSession Lifecycle 19 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 20 | // Called when a new scene session is being created. 21 | // Use this method to select a configuration to create the new scene with. 22 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 23 | } 24 | 25 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 26 | // Called when the user discards a scene session. 27 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 28 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 14 | // Override point for customization after application launch. 15 | return true 16 | } 17 | 18 | // MARK: UISceneSession Lifecycle 19 | 20 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 21 | // Called when a new scene session is being created. 22 | // Use this method to select a configuration to create the new scene with. 23 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 24 | } 25 | 26 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 27 | // Called when the user discards a scene session. 28 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 29 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 30 | } 31 | 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/ImageSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ImageSample: View { 12 | var body: some View { 13 | ScrollView { 14 | VStack(spacing: 16) { 15 | Image("wing") 16 | .frame(width: 80, height: 100) 17 | 18 | Image(systemName: "moon") 19 | .resizable() 20 | .frame(width: 70, height: 100) 21 | 22 | Image(systemName: "moon") 23 | .resizable() 24 | .aspectRatio(contentMode: .fill) 25 | .frame(width: 70, height: 100) 26 | 27 | Image(systemName: "moon") 28 | .resizable() 29 | .aspectRatio(contentMode: .fit) 30 | .frame(width: 70, height: 100) 31 | 32 | Image(systemName: "sunset.fill") 33 | .resizable() 34 | .renderingMode(.template) 35 | .aspectRatio(contentMode: .fit) 36 | .foregroundColor(Color.red) 37 | .frame(width: 80, height: 100) 38 | } 39 | } 40 | .padding() 41 | .frame(width: UIScreen.main.bounds.width) 42 | } 43 | } 44 | 45 | struct ImageSample_Previews: PreviewProvider { 46 | static var previews: some View { 47 | ImageSample() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CombineIntroduce/CombineIntroduce.playground/Pages/Subjects.xcplaygroundpage/Contents.swift: -------------------------------------------------------------------------------- 1 | //: [Previous](@previous) 2 | 3 | import Foundation 4 | import Combine 5 | import SwiftUI 6 | 7 | do { 8 | class Logger { 9 | var tappedEvent = PassthroughSubject() 10 | } 11 | 12 | let logger = Logger() 13 | let subscriber = logger.tappedEvent.sink(receiveValue: { event in 14 | print("event Name: \(event)") 15 | }) 16 | logger.tappedEvent.send("LoginButton") 17 | logger.tappedEvent.send("CameraButton") 18 | subscriber.cancel() 19 | logger.tappedEvent.send("LogoutButton") 20 | } 21 | 22 | do { 23 | class Logger { 24 | var tappedEvent = CurrentValueSubject("") 25 | } 26 | 27 | let logger = Logger() 28 | let subscriber = logger.tappedEvent.sink(receiveValue: { event in 29 | print("event Name: \(event)") 30 | }) 31 | logger.tappedEvent.send("LoginButton") 32 | logger.tappedEvent.value = "CameraButton" 33 | 34 | subscriber.cancel() 35 | 36 | logger.tappedEvent.value = "LogoutButton" 37 | } 38 | 39 | do { 40 | class Logger { 41 | @Published var tappedEventName: String = "" 42 | } 43 | let logger = Logger() 44 | let subscriber = logger.$tappedEventName.sink(receiveValue: { event in 45 | print("event Name: \(event)") 46 | }) 47 | logger.tappedEventName = "LoginButton" 48 | logger.tappedEventName = "CameraButton" 49 | subscriber.cancel() 50 | logger.tappedEventName = "LogoutButton" 51 | } 52 | 53 | //: [Next](@next) 54 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DrawingApp 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftUIOverview 4 | // 5 | // Created by satoutakeshi on 2020/02/03. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Views/TodoDetail/TodoDetailView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoDetailView.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct TodoDetailView: View { 11 | let todo: TodoListItem 12 | var body: some View { 13 | Form { 14 | Section(header: Text("Title")) { 15 | Text(todo.title) 16 | } 17 | Section(header: Text("優先度")) { 18 | Picker("優先度", selection: Binding.constant(todo.priority)) { 19 | Text("低") 20 | .tag(TodoPriority.low) 21 | Text("中") 22 | .tag(TodoPriority.medium) 23 | Text("高") 24 | .tag(TodoPriority.high) 25 | } 26 | .pickerStyle(SegmentedPickerStyle()) 27 | } 28 | 29 | Section(header: Text("締め切り")) { 30 | DatePicker("", selection: .constant(todo.startDate)) 31 | .disabled(true) 32 | } 33 | Section(header: Text("メモ")) { 34 | TextEditor(text: .constant(todo.note)) 35 | .foregroundColor(.black) 36 | .frame(height: 200) 37 | } 38 | } 39 | .navigationTitle("詳細") 40 | } 41 | } 42 | 43 | struct TodoDetailView_Previews: PreviewProvider { 44 | static var previews: some View { 45 | TodoDetailView(todo: TodoListItem(startDate: Date(), note: "アジェンダを事前に作成しておく", priority: .low, title: "開発MTG")) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GeometryReaderSample 4 | // 5 | // Created by satoutakeshi on 2019/12/15. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/27. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminderUITests/TodoReminderUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoReminderUITests.swift 3 | // TodoReminderUITests 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import XCTest 9 | 10 | class TodoReminderUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSampleUITests/AppSceneSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppSceneSampleUITests.swift 3 | // AppSceneSampleUITests 4 | // 5 | // Created by t-sato on 2020/09/12. 6 | // 7 | 8 | import XCTest 9 | 10 | class AppSceneSampleUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/TabViewSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TabViewSample.swift 3 | // BasicViews 4 | // 5 | // Created by t-sato on 2020/08/30. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct TabViewSample: View { 12 | var body: some View { 13 | TabView { 14 | ListView() 15 | .tabItem { 16 | Image(systemName: "list.dash") 17 | Text("List") 18 | } 19 | Text("Settings Page") 20 | .font(.largeTitle) 21 | .fontWeight(.heavy) 22 | .underline() 23 | .tabItem { 24 | Image(systemName: "gear") 25 | Text("Settings") 26 | } 27 | } 28 | } 29 | } 30 | 31 | struct TabViewSample_Previews: PreviewProvider { 32 | static var previews: some View { 33 | TabViewSample() 34 | } 35 | } 36 | 37 | struct ListView: View { 38 | var body: some View { 39 | NavigationView { 40 | List { 41 | ForEach(0 ..< 10) { index in 42 | 43 | NavigationLink( 44 | destination: Text("detail: \(index) cell"), 45 | label: { 46 | HStack { 47 | Image(systemName: "heart.fill") 48 | Text("\(index)") 49 | } 50 | }) 51 | } 52 | } 53 | .navigationBarTitle("Tab") 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /BasicViews/BasicViewsUITests/BasicViewsUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BasicViewsUITests.swift 3 | // BasicViewsUITests 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class BasicViewsUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSampleUITests/DataFlowSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataFlowSampleUITests.swift 3 | // DataFlowSampleUITests 4 | // 5 | // Created by satoutakeshi on 2020/09/17. 6 | // 7 | 8 | import XCTest 9 | 10 | class DataFlowSampleUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /DrawingApp/DrawingAppUITests/DrawingAppUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawingAppUITests.swift 3 | // DrawingAppUITests 4 | // 5 | // Created by satoutakeshi on 2020/02/22. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DrawingAppUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /FilterSample/FilterSampleUITests/CameraSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CameraSampleUITests.swift 3 | // CameraSampleUITests 4 | // 5 | // Created by satoutakeshi on 2019/12/21. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class CameraSampleUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverviewUITests/SwiftUIOverviewUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUIOverviewUITests.swift 3 | // SwiftUIOverviewUITests 4 | // 5 | // Created by satoutakeshi on 2020/02/03. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SwiftUIOverviewUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/View/DrawingViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawingViewModel.swift 3 | // DrawingApp 4 | // 5 | // Created by satoutakeshi on 2020/02/23. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | final class DrawingViewModel: NSObject, ObservableObject { 12 | enum Inputs { 13 | case tappedCaptureButton(canvasRect: CGRect, image: UIImage) 14 | } 15 | 16 | @Published var isShowAlert: Bool = false 17 | private(set) var alertTitle: String = "" 18 | 19 | func apply(inputs: Inputs) { 20 | switch inputs { 21 | case .tappedCaptureButton(let canvasRect, let image): 22 | let croppedImage = cropImage(with: image, rect: canvasRect) 23 | UIImageWriteToSavedPhotosAlbum(croppedImage!, self, #selector(imageSaveCompletion(_:didFinishSavingWithError:contextInfo:)), nil) 24 | } 25 | } 26 | 27 | private func cropImage(with image: UIImage, rect: CGRect) -> UIImage? { 28 | let ajustRect = CGRect(x: rect.origin.x * image.scale, y: rect.origin.y * image.scale, width: rect.width * image.scale, height: rect.height * image.scale) 29 | guard let img = image.cgImage?.cropping(to: ajustRect) else { return nil } 30 | let croppedImage = UIImage(cgImage: img, scale: image.scale, orientation: image.imageOrientation) 31 | return croppedImage 32 | } 33 | 34 | //MARK: - Add image to Library 35 | @objc func imageSaveCompletion(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { 36 | alertTitle = error == nil ? "画像が保存されました" : error?.localizedDescription ?? "" 37 | isShowAlert = true 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/ActionSheetSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ActionSheetSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ActionSheetSample: View { 12 | 13 | @State private var isShowActionSheet: Bool = false 14 | var body: some View { 15 | Button(action: { 16 | isShowActionSheet = true 17 | }) { 18 | Image(systemName: "car") 19 | .resizable() 20 | .aspectRatio(contentMode: .fit) 21 | .frame(width: 60, height: 60) 22 | } 23 | .actionSheet(isPresented: $isShowActionSheet) { () -> ActionSheet in 24 | ActionSheet(title: Text("交通手段"), 25 | message: Text("利用するものを選んでください"), 26 | buttons: [ 27 | .default(Text("自動車"), action: { 28 | print("自動車を選んだ") 29 | }), 30 | .default(Text("電車"), action: { 31 | print("電車を選んだ") 32 | }), 33 | .destructive(Text("徒歩"), action: { 34 | print("徒歩を選んだ。大変だよ") 35 | }), 36 | .cancel(Text("選択しない"), action: { 37 | print("選択しない") 38 | }) 39 | ]) 40 | } 41 | } 42 | } 43 | 44 | struct ActionSheetSample_Previews: PreviewProvider { 45 | static var previews: some View { 46 | ActionSheetSample() 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleUITests/GitHubApiClientSampleUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GitHubApiClientSampleUITests.swift 3 | // GitHubApiClientSampleUITests 4 | // 5 | // Created by satoutakeshi on 2020/01/27. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class GitHubApiClientSampleUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/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 | 50 | 51 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/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 | 50 | 51 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/ScrollViewSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScrollViewSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ScrollViewSample: View { 12 | var body: some View { 13 | ScrollView(.vertical, showsIndicators: true) { 14 | VStack { 15 | ScrollView(.horizontal) { 16 | HStack { 17 | FixedSizeRectangle(color: .red) 18 | FixedSizeRectangle(color: .red) 19 | FixedSizeRectangle(color: .red) 20 | } 21 | } 22 | ScrollView(.horizontal) { 23 | HStack { 24 | FixedSizeRectangle(color: .yellow) 25 | FixedSizeRectangle(color: .yellow) 26 | FixedSizeRectangle(color: .yellow) 27 | } 28 | } 29 | ScrollView(.horizontal) { 30 | HStack { 31 | FixedSizeRectangle(color: .blue) 32 | FixedSizeRectangle(color: .blue) 33 | FixedSizeRectangle(color: .blue) 34 | } 35 | } 36 | } 37 | .padding() 38 | .frame(width: UIScreen.main.bounds.width) 39 | } 40 | } 41 | } 42 | 43 | struct FixedSizeRectangle: View { 44 | var color: Color 45 | var body: some View { 46 | Rectangle() 47 | .frame(width: 200, height: 100) 48 | .foregroundColor(color) 49 | .cornerRadius(20) 50 | } 51 | } 52 | 53 | struct ScrollViewSample_Previews: PreviewProvider { 54 | static var previews: some View { 55 | ScrollViewSample() 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/ObjectLifecycle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectLifecycle.swift 3 | // DataFlowSample 4 | // 5 | // Created by satoutakeshi on 2020/12/07. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct StateObjectCounterView: View { 11 | @StateObject private var dataSource = DataSource() 12 | var body: some View { 13 | VStack { 14 | Button("increment counter") { 15 | dataSource.counter += 1 16 | } 17 | Text("StateObject count: \(dataSource.counter)") 18 | .font(.title) 19 | } 20 | } 21 | } 22 | 23 | struct ObservedObjcetCounterView: View { 24 | @ObservedObject private var dataSource = DataSource() 25 | var body: some View { 26 | VStack { 27 | Button("increment counter") { 28 | dataSource.counter += 1 29 | } 30 | Text("ObservedObject count: \(dataSource.counter)") 31 | .font(.title) 32 | } 33 | } 34 | } 35 | 36 | struct SwitchColorView: View { 37 | @State private var isDanger: Bool = false 38 | var body: some View { 39 | VStack { 40 | Button("Change the Color") { 41 | isDanger.toggle() 42 | } 43 | if isDanger { 44 | Circle().foregroundColor(.red) 45 | .frame(width: 200, height: 200) 46 | } else { 47 | Circle().foregroundColor(.green) 48 | .frame(width: 200, height: 200) 49 | } 50 | StateObjectCounterView() 51 | ObservedObjcetCounterView() 52 | Spacer() 53 | } 54 | } 55 | } 56 | 57 | struct CountView_Previews: PreviewProvider { 58 | static var previews: some View { 59 | SwitchColorView() 60 | .previewLayout(.fixed(width: 200, height: 400)) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/ResearchGeometry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ResearchGeometry.swift 3 | // GeometryReaderSample 4 | // 5 | // Created by satoutakeshi on 2019/12/15. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ResearchGeometry: View { 12 | var body: some View { 13 | ScrollView { 14 | VStack { 15 | Text("GeometryReader Get Global Origin") 16 | GeometryRectangle(color: Color.pink) 17 | GeometryRectangle(color: Color.red) 18 | .offset(x: 10, y: 0) 19 | ZStack { 20 | GeometryRectangle(color: Color.blue) 21 | .offset(x: 30, y: 0) 22 | }.offset(x: 10, y: 0) 23 | } 24 | } 25 | } 26 | } 27 | 28 | struct GeometryRectangle: View { 29 | var color: Color 30 | var body: some View { 31 | GeometryReader { geometry in 32 | RoundedRectangle(cornerRadius: 20) 33 | .fill(self.color) 34 | .overlay( 35 | VStack { 36 | Text("X: \(Int(geometry.frame(in: .global).origin.x)) Y: \(Int(geometry.frame(in: .global).origin.y)) width: \(Int(geometry.frame(in: .global).width)) height: \(Int(geometry.frame(in: .global).height))") 37 | .foregroundColor(.white) 38 | .fontWeight(.heavy) 39 | Text("size: \(geometry.size.debugDescription)") 40 | .foregroundColor(.white) 41 | .fontWeight(.heavy) 42 | }) 43 | 44 | 45 | }.frame(height: 100) 46 | } 47 | } 48 | 49 | struct ResearchGeometry_Previews: PreviewProvider { 50 | static var previews: some View { 51 | ResearchGeometry() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Content/ImagePicker/ImagePicker.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePicker.swift 3 | // CameraSample 4 | // 5 | // Created by satoutakeshi on 2019/12/22. 6 | // Copyright © 2019 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ImagePicker { 12 | /// MARK: - Properties 13 | @Binding var isShown: Bool 14 | @Binding var image: UIImage? 15 | var sourceType: UIImagePickerController.SourceType 16 | } 17 | 18 | extension ImagePicker: UIViewControllerRepresentable { 19 | typealias UIViewControllerType = UIImagePickerController 20 | 21 | func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIImagePickerController { 22 | let imagePicker = UIImagePickerController() 23 | imagePicker.sourceType = sourceType 24 | imagePicker.delegate = context.coordinator 25 | return imagePicker 26 | } 27 | 28 | func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext) {} 29 | 30 | func makeCoordinator() -> Coordinator { 31 | return Coordinator(parent: self) 32 | } 33 | } 34 | 35 | final class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { 36 | let parent: ImagePicker 37 | 38 | init(parent: ImagePicker) { 39 | self.parent = parent 40 | } 41 | func imagePickerController(_ picker: UIImagePickerController, 42 | didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { 43 | guard let originalImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage else { return } 44 | parent.image = originalImage 45 | parent.isShown = false 46 | } 47 | func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { 48 | parent.isShown = false 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSampleTests/HomeViewModelTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewModelTests.swift 3 | // GitHubApiClientSampleTests 4 | // 5 | // Created by satoutakeshi on 2020/02/01. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import GitHubApiClientSample 11 | 12 | class HomeViewModelTests: XCTestCase { 13 | 14 | func testOnEnter() { 15 | let apiService = MockAPIService() 16 | apiService.stub(for: SearchRepositoryRequest.self) { _ in 17 | Result.Publisher( 18 | SearchRepositoryResponse( 19 | items: [ 20 | .init(id: 0, 21 | name: "takeshi", 22 | description: "brabrabara", 23 | stargazersCount: 100, 24 | language: "Swift", 25 | htmlUrl: "https://example.com", 26 | owner: Owner(id: 1, 27 | avatarUrl: "https://example.com/photo.png")) 28 | ] 29 | ) 30 | ).eraseToAnyPublisher() 31 | } 32 | 33 | let viewModel = HomeViewModel(apiService: apiService) 34 | viewModel.apply(inputs: .onCommit(text: "test")) 35 | XCTAssertTrue(!viewModel.cardViewInputs.isEmpty) 36 | } 37 | 38 | func testOnError() { 39 | let apiService = MockAPIService() 40 | apiService.stub(for: SearchRepositoryRequest.self) { _ in 41 | Result.Publisher( 42 | APIServiceError.responseError 43 | ).eraseToAnyPublisher() 44 | } 45 | let viewModel = HomeViewModel(apiService: apiService) 46 | viewModel.apply(inputs: .onCommit(text: "test")) 47 | XCTAssertTrue(viewModel.isShowError) 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/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 | NSUserActivityTypes 24 | 25 | IntentIntent 26 | PrioritySelectionIntent 27 | 28 | UIApplicationSceneManifest 29 | 30 | UIApplicationSupportsMultipleScenes 31 | 32 | 33 | UIApplicationSupportsIndirectInputEvents 34 | 35 | UILaunchScreen 36 | 37 | UIRequiredDeviceCapabilities 38 | 39 | armv7 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationPortraitUpsideDown 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/iOS14/GridSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GridSample.swift 3 | // BasicViews 4 | // 5 | // Created by t-sato on 2020/09/04. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | @available(iOS 14.0, *) 12 | let threeColumns = [ 13 | GridItem(spacing: 0), 14 | GridItem(spacing: 0), 15 | GridItem(spacing: 0) 16 | ] 17 | 18 | @available(iOS 14.0, *) 19 | let fixedThreeColumns = [ 20 | GridItem(.fixed(100)), 21 | GridItem(.fixed(100)), 22 | GridItem(.fixed(100)) 23 | ] 24 | 25 | @available(iOS 14.0, *) 26 | let flexibleColumns = [ 27 | GridItem(.flexible(minimum: 100)) 28 | ] 29 | 30 | @available(iOS 14.0, *) 31 | let adaptiveColumns = [ 32 | GridItem(.adaptive(minimum: 100)) 33 | ] 34 | 35 | 36 | @available(iOS 14.0, *) 37 | struct GridSample: View { 38 | let columns: [GridItem] 39 | var body: some View { 40 | ScrollView { 41 | LazyVGrid(columns: columns, spacing: 0) { 42 | ForEach(0 ..< 100) { _ in 43 | Image("seal_\(Int.random(in: 1 ... 3))") 44 | .resizable() 45 | .aspectRatio(contentMode: .fit) 46 | } 47 | } 48 | } 49 | } 50 | } 51 | 52 | @available(iOS 14.0, *) 53 | struct GridSample_Previews: PreviewProvider { 54 | static var previews: some View { 55 | Group { 56 | GridSample(columns: threeColumns) 57 | .previewDevice(PreviewDevice(rawValue: "iPhone X")) 58 | GridSample(columns: fixedThreeColumns) 59 | .previewDevice(PreviewDevice(rawValue: "iPhone X")) 60 | GridSample(columns: flexibleColumns) 61 | .previewDevice(PreviewDevice(rawValue: "iPhone X")) 62 | GridSample(columns: adaptiveColumns) 63 | .previewDevice(PreviewDevice(rawValue: "iPhone X")) 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/ImageViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageViewController.swift 3 | // SwiftUIOverview 4 | // 5 | // Created by satoutakeshi on 2020/02/03. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ImageViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | let imageView = UIImageView(image: UIImage(named: "wing")) 17 | imageView.contentMode = .scaleAspectFit 18 | imageView.layer.cornerRadius = 10 19 | imageView.clipsToBounds = true 20 | 21 | let shadowView = UIView() 22 | shadowView.layer.cornerRadius = 10 23 | shadowView.layer.shadowColor = UIColor.gray.cgColor 24 | shadowView.layer.shadowOffset = CGSize(width: 10, height: 10) 25 | shadowView.layer.shadowRadius = 10 26 | shadowView.layer.shadowOpacity = 1 27 | shadowView.backgroundColor = .white 28 | 29 | view.addSubview(shadowView) 30 | view.addSubview(imageView) 31 | 32 | 33 | imageView.translatesAutoresizingMaskIntoConstraints = false 34 | shadowView.translatesAutoresizingMaskIntoConstraints = false 35 | view.backgroundColor = .white 36 | imageView.centerXAnchor.constraint(equalToSystemSpacingAfter: view.centerXAnchor, multiplier: 1).isActive = true 37 | imageView.centerYAnchor.constraint(equalToSystemSpacingBelow: view.centerYAnchor, multiplier: 1).isActive = true 38 | 39 | shadowView.widthAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 1).isActive = true 40 | shadowView.heightAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: 1).isActive = true 41 | shadowView.centerXAnchor.constraint(equalToSystemSpacingAfter: view.centerXAnchor, multiplier: 1).isActive = true 42 | shadowView.centerYAnchor.constraint(equalToSystemSpacingBelow: view.centerYAnchor, multiplier: 1).isActive = true 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Service/APIService.swift: -------------------------------------------------------------------------------- 1 | // 2 | // APIService.swift 3 | // GitHubApiClientSample 4 | // 5 | // Created by satoutakeshi on 2020/01/28. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | 12 | protocol APIRequestType { 13 | associatedtype Response: Decodable 14 | 15 | var path: String { get } 16 | var queryItems: [URLQueryItem]? { get } 17 | } 18 | 19 | protocol APIServiceType { 20 | func request(with request: Request) -> AnyPublisher where Request: APIRequestType 21 | } 22 | 23 | final class APIService: APIServiceType { 24 | 25 | private let baseURLString: String 26 | init(baseURLString: String = "https://api.github.com") { 27 | self.baseURLString = baseURLString 28 | } 29 | 30 | func request(with request: Request) -> AnyPublisher where Request: APIRequestType { 31 | 32 | guard let pathURL = URL(string: request.path, relativeTo: URL(string: baseURLString)) else { 33 | return Fail(error: APIServiceError.invalidURL).eraseToAnyPublisher() 34 | } 35 | 36 | var urlComponents = URLComponents(url: pathURL, resolvingAgainstBaseURL: true)! 37 | urlComponents.queryItems = request.queryItems 38 | var request = URLRequest(url: urlComponents.url!) 39 | request.addValue("application/json", forHTTPHeaderField: "Accept") 40 | 41 | let decorder = JSONDecoder() 42 | decorder.keyDecodingStrategy = .convertFromSnakeCase 43 | return URLSession.shared.dataTaskPublisher(for: request) 44 | .map { data, urlResponse in data } 45 | .mapError { _ in APIServiceError.responseError } 46 | .decode(type: Request.Response.self, decoder: decorder) 47 | .mapError({ (error) -> APIServiceError in 48 | APIServiceError.parseError(error) 49 | }) 50 | .receive(on: RunLoop.main) 51 | .eraseToAnyPublisher() 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Views/TodoList/TodoListViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TodoListViewModel.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | final class TodoListViewModel: ObservableObject { 11 | enum Inputs { 12 | case onAppear 13 | case onDismissAddTodo 14 | case openFromWidget(url: URL) 15 | } 16 | @Published var todoList: [TodoListItem] = [] 17 | @Published var activeTodoId: UUID? 18 | 19 | private let todoStore = TodoListStore() 20 | func apply(inputs: Inputs) { 21 | switch inputs { 22 | case .onAppear: 23 | updateTodo() 24 | case .onDismissAddTodo: 25 | updateTodo() 26 | case .openFromWidget(let url): 27 | if let selectedId = getWidgetTodoItemID(from: url) { 28 | activeTodoId = selectedId 29 | } 30 | } 31 | } 32 | 33 | /// WidgetのURLSchemeからidを取得する 34 | /// - Parameter url: WidgetからのDeepLink URL. todolist://detail?id=E621E1F8-C36C-495A-93FC-0C247A3E6E5F. 35 | /// - Returns: id 36 | func getWidgetTodoItemID(from url: URL) -> UUID? { 37 | guard let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: true), 38 | urlComponents.scheme == "todolist", 39 | urlComponents.host == "detail", 40 | urlComponents.queryItems?.first?.name == "id", 41 | let idValue = urlComponents.queryItems?.first?.value else { 42 | return nil 43 | } 44 | return UUID(uuidString: idValue) 45 | } 46 | 47 | private func updateTodo() { 48 | do { 49 | let list = try todoStore.fetchAll() 50 | print("list count is \(list.count)") 51 | todoList = list 52 | } catch let error { 53 | print(error.localizedDescription) 54 | } 55 | } 56 | 57 | private func fechtTodoItem(by id: String) { 58 | 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /FilterSample/FilterSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /TodoReminder/TodoWidget/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 | -------------------------------------------------------------------------------- /AppSceneSample/AppSceneSample/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 | -------------------------------------------------------------------------------- /DataFlowSample/DataFlowSample/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 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /BasicViews/BasicViews/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 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/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 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /GeometryReaderSample/GeometryReaderSample/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 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /SwiftUIOverview/SwiftUIOverview/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUIOverview 4 | // 5 | // Created by satoutakeshi on 2020/02/03. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct ContentView: View { 12 | var body: some View { 13 | Text("Hello World") 14 | .frame(width: 60, height: 30) 15 | } 16 | } 17 | 18 | struct BigImageThanParent: View { 19 | var body: some View { 20 | Image("wing") 21 | .resizable() 22 | .frame(width: 30, height: 30) 23 | } 24 | } 25 | 26 | struct HorizonStack: View { 27 | var body: some View { 28 | HStack(alignment: .center, spacing: 10) { 29 | Text("First") 30 | Image("wing").layoutPriority(2) 31 | Text("HStackSecondText").layoutPriority(1) 32 | } 33 | .frame(width: 200) 34 | } 35 | } 36 | 37 | struct ZIndexStack: View { 38 | var body: some View { 39 | ZStack { 40 | Text("First") 41 | Image("wing") 42 | Text("HStackSecondText") 43 | } 44 | .frame(width: 200) 45 | } 46 | } 47 | 48 | struct CircleImage: View { 49 | var body: some View { 50 | Image("wing") 51 | .cornerRadius(10) 52 | .shadow(color: .gray, radius: 10, x: 10, y: 10) 53 | } 54 | } 55 | 56 | struct BindingView: View { 57 | @State var inputText: String = "" 58 | var body: some View { 59 | VStack { 60 | TextField("", text: $inputText) 61 | .textFieldStyle(RoundedBorderTextFieldStyle()) 62 | .padding() 63 | Text(inputText) 64 | } 65 | } 66 | } 67 | 68 | struct ContentView_Previews: PreviewProvider { 69 | static var previews: some View { 70 | Group { 71 | ContentView() 72 | BigImageThanParent() 73 | CircleImage() 74 | .previewLayout(.fixed(width: 300, height: 200)) 75 | .edgesIgnoringSafeArea(.all) 76 | BindingView() 77 | HorizonStack() 78 | ZIndexStack() 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /GitHubApiClientSample/GitHubApiClientSample/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 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /TodoReminder/TodoReminder/Views/AddTodo/AddTodoView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AddTodoView.swift 3 | // TodoReminder 4 | // 5 | // Created by satoutakeshi on 2020/08/11. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct AddTodoView: View { 11 | @State private var newTodo: TodoListItem = TodoListItem(startDate: Date(), note: "", priority: .low, title: "") 12 | @Binding var isShow: Bool 13 | var body: some View { 14 | NavigationView { 15 | Form { 16 | Section(header: Text("タイトル")) { 17 | TextField("例:ミーティング", text: $newTodo.title) 18 | } 19 | Section(header: Text("優先度")) { 20 | Picker("優先度", selection: $newTodo.priority) { 21 | Text("低") 22 | .tag(TodoPriority.low) 23 | Text("中") 24 | .tag(TodoPriority.medium) 25 | Text("高") 26 | .tag(TodoPriority.high) 27 | } 28 | .pickerStyle(SegmentedPickerStyle()) 29 | } 30 | 31 | Section(header: Text("締め切り")) { 32 | DatePicker("", selection: $newTodo.startDate) 33 | } 34 | Section(header: Text("メモ")) { 35 | TextEditor(text: $newTodo.note) 36 | .foregroundColor(.black) 37 | .frame(height: 200) 38 | } 39 | } 40 | .navigationTitle("何をしますか?") 41 | .navigationBarItems(trailing: Button(action: { 42 | let todoStore = TodoListStore() 43 | do { 44 | 45 | try todoStore.insert(item: newTodo) 46 | isShow.toggle() 47 | } catch let error { 48 | print(error.localizedDescription) 49 | } 50 | }, label: { 51 | Text("決定") 52 | })) 53 | } 54 | } 55 | } 56 | 57 | struct AddTodoView_Previews: PreviewProvider { 58 | static var previews: some View { 59 | AddTodoView(isShow: .constant(true)) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /DrawingApp/DrawingApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPhotoLibraryAddUsageDescription 6 | 描いた絵を保存します 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIApplicationSceneManifest 26 | 27 | UIApplicationSupportsMultipleScenes 28 | 29 | UISceneConfigurations 30 | 31 | UIWindowSceneSessionRoleApplication 32 | 33 | 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /FilterSample/FilterSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPhotoLibraryAddUsageDescription 6 | Filterした画像を保存します 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | フィルターする画像を選びます 27 | UIApplicationSceneManifest 28 | 29 | UIApplicationSupportsMultipleScenes 30 | 31 | UISceneConfigurations 32 | 33 | UIWindowSceneSessionRoleApplication 34 | 35 | 36 | UISceneConfigurationName 37 | Default Configuration 38 | UISceneDelegateClassName 39 | $(PRODUCT_MODULE_NAME).SceneDelegate 40 | 41 | 42 | 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /BasicViews/BasicViews/Views/AlertSample.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertSample.swift 3 | // BasicViews 4 | // 5 | // Created by satoutakeshi on 2020/02/10. 6 | // Copyright © 2020 satoutakeshi. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct AlertSample: View { 12 | @State private var isShowOkAlert: Bool = false 13 | @State private var isShowErrorAlert: Bool = false 14 | @State private var isShowRetryAlert: Bool = false 15 | var okAlert: Alert = Alert(title: Text("Download Success!")) 16 | var errorAlert: Alert = Alert(title: Text("An error occurred"), message: Text("Retry later!"), dismissButton: .default(Text("Close"))) 17 | var retryAlert: Alert = Alert(title: Text("Error"), message: Text("please wait a minute"), primaryButton: .default(Text("Retry"), action: { 18 | print("tapped retry button") 19 | }), secondaryButton: .cancel()) 20 | var body: some View { 21 | VStack { 22 | Button(action: { 23 | isShowOkAlert = true 24 | }) { 25 | Image(systemName: "square.and.arrow.down") 26 | .resizable() 27 | .aspectRatio(contentMode: .fit) 28 | .frame(width: 44, height: 44) 29 | } 30 | .alert(isPresented: $isShowOkAlert) { () -> Alert in 31 | okAlert 32 | } 33 | Button(action: { 34 | isShowErrorAlert = true 35 | }) { 36 | Image(systemName: "play") 37 | .resizable() 38 | .aspectRatio(contentMode: .fit) 39 | .frame(width: 44, height: 44) 40 | } 41 | .alert(isPresented: $isShowErrorAlert) { () -> Alert in 42 | errorAlert 43 | } 44 | 45 | Button(action: { 46 | isShowRetryAlert = true 47 | }) { 48 | Image(systemName: "person.badge.plus") 49 | .resizable() 50 | .aspectRatio(contentMode: .fit) 51 | .frame(width: 44, height: 44) 52 | } 53 | .alert(isPresented: $isShowRetryAlert) { () -> Alert in 54 | retryAlert 55 | } 56 | } 57 | } 58 | } 59 | 60 | struct AlertSample_Previews: PreviewProvider { 61 | static var previews: some View { 62 | AlertSample() 63 | } 64 | } 65 | --------------------------------------------------------------------------------