Skip to content

Commit

Permalink
update exercise descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
grafele committed Oct 30, 2019
1 parent 706d40f commit 966dbd1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
14 changes: 8 additions & 6 deletions SwiftUITalk/Views/BlogListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ struct PostCell: View {
let post: Post

var body: some View {
VStack(spacing: 8) {
Image(uiImage: post.header)
.resizable()
.scaledToFit()
.frame(minWidth: 0, maxWidth: .infinity)
Image(uiImage: post.header)
.resizable()
.scaledToFit()

}.padding(.vertical, 16)
// Exercise 2: Create a nice looking UI for the cells like shown on the slides

// Hint 1: Stacks are really helpful to create a UI like this
// Hint 2: Use predefined Colors like .primary and .secondary
}

}

struct BlogListView_Previews: PreviewProvider {
static var previews: some View {
BlogListView(posts: DataService().getPosts())

}
}
15 changes: 10 additions & 5 deletions SwiftUITalk/Views/DragRectangleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ import SwiftUI

struct DragRectangleView: View {

@State private var translation: CGSize = .zero
@State private var isDragging = false

var body: some View {
BockView()
BlockView()
// Exercise 3.1: Make BlockView draggable and follow your finger
// Exercise 3.2: Animate only the movement back to the original position when lifting up your finger
// Exercise 3.3: Add scaleEffect when Block is being moved
// Exercise 3.4: Change the rectangles color based on its position

// Hint 1: DragGesture and .offset are your friend
// Hint 2: Use minimumDistance: 0 to react to touch events without movements as well
// Hint 3: An animation duration of 0 can help you deactivate animations for specic usecases
}

}

struct BockView: View {
struct BlockView: View {

var body: some View {
Rectangle()
Expand Down
2 changes: 2 additions & 0 deletions SwiftUITalk/Views/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct LoginView: View {
SecureField("Password", text: $password)
}

// Exercise 1: Add new Toggl element for accepting terms and conditions

NavigationLink("Submit", destination: BlogListView(posts: DataService().getPosts()))
.disabled(username.isEmpty || password.isEmpty)
}.navigationBarTitle("Login", displayMode: .inline)
Expand Down

0 comments on commit 966dbd1

Please sign in to comment.