Skip to content

Commit

Permalink
Added any layout showdown and app icon
Browse files Browse the repository at this point in the history
  • Loading branch information
VerticalHeretic committed Sep 4, 2022
1 parent a5fb832 commit e09c5fb
Show file tree
Hide file tree
Showing 36 changed files with 253 additions and 4 deletions.
4 changes: 4 additions & 0 deletions iOS16-SwiftUI-Showdown.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
A0EE252228C49F3F00DA5698 /* TextFieldScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0EE252128C49F3F00DA5698 /* TextFieldScreen.swift */; };
A0EE252428C4E78600DA5698 /* GridScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0EE252328C4E78600DA5698 /* GridScreen.swift */; };
A0EE252628C4F07800DA5698 /* ViewThatFitsScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0EE252528C4F07800DA5698 /* ViewThatFitsScreen.swift */; };
A0EE252828C4F3D700DA5698 /* LayoutScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0EE252728C4F3D700DA5698 /* LayoutScreen.swift */; };
A0FAA4A128BB4B7900F2C87E /* JSONDecoder+Singleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0FAA4A028BB4B7900F2C87E /* JSONDecoder+Singleton.swift */; };
/* End PBXBuildFile section */

Expand All @@ -43,6 +44,7 @@
A0EE252128C49F3F00DA5698 /* TextFieldScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldScreen.swift; sourceTree = "<group>"; };
A0EE252328C4E78600DA5698 /* GridScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridScreen.swift; sourceTree = "<group>"; };
A0EE252528C4F07800DA5698 /* ViewThatFitsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewThatFitsScreen.swift; sourceTree = "<group>"; };
A0EE252728C4F3D700DA5698 /* LayoutScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutScreen.swift; sourceTree = "<group>"; };
A0FAA49F28BB43FE00F2C87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
A0FAA4A028BB4B7900F2C87E /* JSONDecoder+Singleton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONDecoder+Singleton.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -126,6 +128,7 @@
A0EE252128C49F3F00DA5698 /* TextFieldScreen.swift */,
A0EE252328C4E78600DA5698 /* GridScreen.swift */,
A0EE252528C4F07800DA5698 /* ViewThatFitsScreen.swift */,
A0EE252728C4F3D700DA5698 /* LayoutScreen.swift */,
);
path = Screens;
sourceTree = "<group>";
Expand Down Expand Up @@ -244,6 +247,7 @@
A072717828BA4B1300D354DC /* ContentView.swift in Sources */,
A072718A28BA8CAA00D354DC /* GaugeScreen.swift in Sources */,
A0C81B6228C07D8700F46E1D /* FeatureType.swift in Sources */,
A0EE252828C4F3D700DA5698 /* LayoutScreen.swift in Sources */,
A072717628BA4B1300D354DC /* iOS16_SwiftUI_ShowdownApp.swift in Sources */,
A0EE252628C4F07800DA5698 /* ViewThatFitsScreen.swift in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,169 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"filename" : "notification40.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "notification60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "settings58.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "settings87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "spotlight80.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "spotlight120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "iphone120.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "iphone180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "ipadNotification20.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "ipadNotification40.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "ipadSettings29.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "ipadSettings58.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "ipadSpotlight40.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "ipadSpotlight80.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "ipad76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "ipad152.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "ipadPro167.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "appstore1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"filename" : "mac16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "mac32.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "mac32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "mac64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "mac128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "mac256.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "mac256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "mac512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "mac512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "mac1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "laurenz-heymann-wAygsCk20h8-unsplash.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "priscilla-du-preez-CoqJGsFVJtM-unsplash.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
2 changes: 2 additions & 0 deletions iOS16-SwiftUI-Showdown/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ struct ContentView: View {
GridScreen(feature: feature)
case .viewThatFits:
ViewThatFitsScreen(feature: feature)
case .layout:
LayoutScreen(feature: feature)
}
}
.navigationTitle("iOS16 Features 🚀")
Expand Down
5 changes: 4 additions & 1 deletion iOS16-SwiftUI-Showdown/ContentViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ The Grid view, however, makes it a lot easier.
type: .grid),
Feature(title: "View That Fits 🍕",
description: "It's a layout feature that gives you an ability to analyse the space and present best view layout for it",
type: .viewThatFits)
type: .viewThatFits),
Feature(title: "AnyLayout and Layout Protocol 🛌",
description: "The new version of SwiftUI provides AnyLayout and the Layout protocol for developers to create customized and complex layouts.",
type: .layout)

]

Expand Down
1 change: 1 addition & 0 deletions iOS16-SwiftUI-Showdown/Models/FeatureType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ enum FeatureType: String, Decodable {
case textField
case grid
case viewThatFits
case layout
}
77 changes: 77 additions & 0 deletions iOS16-SwiftUI-Showdown/Screens/LayoutScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// LayoutScreen.swift
// iOS16-SwiftUI-Showdown
//
// Created by Łukasz Stachnik on 04/09/2022.
//

import SwiftUI

struct LayoutScreen: View {
var feature: Feature
@State private var changeLayout = false

var body: some View {
let layout = changeLayout ? AnyLayout(HStackLayout()) : AnyLayout(VStackLayout())
// there is an error in official apple documentation about definining this as of 04 September 2022
let layout2 = changeLayout ? AnyLayout(HStackLayout()) : AnyLayout(GridLayout())

ScrollView {
VStack {
layout {
Image("apple2")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()

Image("apple1")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()
}
.animation(.default, value: changeLayout)
.onTapGesture {
changeLayout.toggle()
}

layout2 {
Image("apple2")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()

Image("apple1")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()

Image("apple1")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()

Image("apple2")
.resizable()
.scaledToFill()
.frame(maxWidth: 300, maxHeight: 200)
.clipped()
}
.animation(.default, value: changeLayout)
.onTapGesture {
changeLayout.toggle()
}
}
}
}
}

struct LayoutScreen_Previews: PreviewProvider {
static var previews: some View {
LayoutScreen(feature: Feature(title: "Layouts", description: "Custom Layouts implementation", type: .layout))
}
}
9 changes: 8 additions & 1 deletion iOS16-SwiftUI-Showdown/Screens/ViewThatFitsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ struct ViewThatFitsScreen: View {
@State var height: Double = 500

var body: some View {

VStack {
Text(feature.description)
.font(.footnote)
.padding()

Image("pizza")
.resizable()
.scaledToFill()
Expand All @@ -30,6 +33,9 @@ struct ViewThatFitsScreen: View {
}
}

Text("Photo by Shourav Sheikh from Unslpash")
.font(.footnote)

ViewThatFits {
VStack {
Button(action: {}) {
Expand Down Expand Up @@ -72,6 +78,7 @@ struct ViewThatFitsScreen: View {
.frame(maxHeight: 100)
}
}
.navigationTitle(feature.title)
}
}

Expand Down

0 comments on commit e09c5fb

Please sign in to comment.