Skip to content

Commit

Permalink
swiftlint
Browse files Browse the repository at this point in the history
  • Loading branch information
IsabellaSulisufi committed Oct 31, 2024
1 parent fe38626 commit e07e173
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 186 deletions.
2 changes: 1 addition & 1 deletion SwiftUIView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// SwiftUIView.swift
//
//
//
// Created by Isabella Sulisufi on 16/08/2024.
//
Expand Down
20 changes: 10 additions & 10 deletions TaskManager/Model/TaskModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@

import Foundation

//struct TaskModel {
// struct TaskModel {
// var id: UUID = UUID()
// var title: String
// var description: String?
//
//
// var startDate: Date
// var dueDate: Date
//
//
// var category: Category
// var isCompleted: Bool
//
//

//}
// }

enum Category: String, CaseIterable {
case school = "School"
case work = "Work"
case personal = "Personal"
case fitness = "Fitness"
}
case school = "School"
case work = "Work"
case personal = "Personal"
case fitness = "Fitness"
}

struct Task {
let title: String
Expand Down
24 changes: 12 additions & 12 deletions TaskManager/Spacing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@
import SwiftUI

struct Spacing {

static let none: CGFloat = 0

static let micro: CGFloat = 4

static let tiny: CGFloat = 8

static let small: CGFloat = 12

static let standard: CGFloat = 16

static let medium: CGFloat = 20

static let considerable: CGFloat = 22

static let spacious: CGFloat = 24

static let large: CGFloat = 30

static let extensive: CGFloat = 32

static let big: CGFloat = 36

static let huge: CGFloat = 40
}
16 changes: 7 additions & 9 deletions TaskManager/TextStyles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ struct TextStyles {
// Style for Titles
static func titleStyle() -> some ViewModifier {
return TextStyleModifier(font: .custom("Gill Sans", size: Spacing.large),
color: Color("DarkPurple"),
applyPadding: false)
color: Color("DarkPurple"),
applyPadding: false)
}

// Style for Descriptions
static func descriptionStyle() -> some ViewModifier {
return TextStyleModifier(font: .custom("Gill Sans", size: Spacing.spacious),
color: Color("DarkPurple"),
applyPadding: false)
color: Color("DarkPurple"),
applyPadding: false)
}

// Style for Bullet Points
static func bulletPointStyle() -> some ViewModifier {
return TextStyleModifier(font: .custom("Gill Sans", size: Spacing.considerable),
color: Color("DarkPurple"),
applyPadding: true)
color: Color("DarkPurple"),
applyPadding: true)
}

struct TextStyleModifier: ViewModifier {
Expand All @@ -42,5 +42,3 @@ struct TextStyles {
}
}
}


20 changes: 10 additions & 10 deletions TaskManager/ViewModel/TaskViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import SwiftUI

class TaskViewModel: ObservableObject {
@Published var taskList: [Task] = []

@Published var selectedDate: Date = Date()
@Published var startDate: Date = Date()

@Published var selectedCategory: Category = .school
@Published var isTaskComplete: Bool = false
@Published var taskTitle: String = ""
@Published var taskDescription: String = ""

var router: Router

init(router: Router) {
self.router = router
}

var dropdownOptions = Category.allCases.map { $0.rawValue }

var task1 = Task(
title: "Science homework",
description: "Biology presentation on anatomy",
Expand All @@ -39,28 +39,28 @@ class TaskViewModel: ObservableObject {
taskList.removeAll()
print(taskList)
}

func addToTaskListArray() {
let newTask = Task(
title: taskTitle,
description: taskDescription,
startDate: startDate,
dueDate: selectedDate,
category:selectedCategory,
category: selectedCategory,
isComplete: isTaskComplete
)
taskList.append(newTask)
print(taskList)
}

func handleButtonToggle() {
isTaskComplete.toggle()
}

func navigateToViewAllTasks() {
router.navigate(to: .aboutPage)
}

func navigateAddTask() {
router.navigate(to: .addTask)
}
Expand Down
168 changes: 78 additions & 90 deletions TaskManager/Views/AboutPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,103 +11,91 @@ struct AboutPageView: View {
@ObservedObject var viewModel: TaskViewModel

var body: some View {


VStack {
HStack {
Image("LogoImage")
.resizable()
.scaledToFit()
.frame(width: 200, height: 100)
}
.padding(.top)

Text("This is ToTask!")
.modifier(TextStyles.descriptionStyle())

Text("An app which allows you to easily add, update, delete and view your tasks")
.modifier(TextStyles.descriptionStyle())
.multilineTextAlignment(.center)

VStack {
HStack {
Image("LogoImage")
.resizable()
.scaledToFit()
.frame(width: 200, height: 100)
}
.padding(.top)


Text("This is ToTask!")
.modifier(TextStyles.descriptionStyle())


Text("An app which allows you to easily add, update, delete and view your tasks")
.modifier(TextStyles.descriptionStyle())
Text("\u{2022} **Time Tracking**: Set due dates to easily monitor task progress.")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)


VStack{
Text("\u{2022} **Time Tracking**: Set due dates to easily monitor task progress.")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)

Text("\u{2022} **Organised Categories**: Categorise tasks for effortless organisation and quick access.")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)


Text("\u{2022} **Daily Overview**: Instantly view all tasks due today on your homepage.")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)
}
.padding(.top)

Spacer()

Text("Start Today and Add A Task!")

Text("\u{2022} **Organised Categories**: Categorise tasks for effortless organisation and quick access.")

Check failure on line 36 in TaskManager/Views/AboutPageView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 121 characters (line_length)

Check warning on line 36 in TaskManager/Views/AboutPageView.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 121 characters (line_length)
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)

Text("\u{2022} **Daily Overview**: Instantly view all tasks due today on your homepage.")
.modifier(TextStyles.bulletPointStyle())
.multilineTextAlignment(.center)

.modifier(TextStyles.descriptionStyle())


}
.padding(.top)

Spacer()

Text("Start Today and Add A Task!")
.multilineTextAlignment(.center)

.modifier(TextStyles.descriptionStyle())

Spacer()

HStack {

// View All Tasks Button

Button {
viewModel.navigateAddTask()

} label: {
Text("View All Tasks")
.font(Font.custom("NotoSansOriya", size: Spacing.medium))
.foregroundColor(Color.cPink)
.padding(Spacing.standard)
.background(Color("DarkestPurple"))
.cornerRadius(Spacing.medium)
}

Spacer()

HStack{


// View All Tasks Button

Button {
viewModel.navigateAddTask()

} label: {
Text("View All Tasks")
.font(Font.custom("NotoSansOriya", size: Spacing.medium))
.foregroundColor(Color.cPink)
.padding(Spacing.standard)
.background(Color("DarkestPurple"))
.cornerRadius(Spacing.medium)
}


Spacer()


//Add Task Button
Button {
viewModel.navigateAddTask()

} label: {
Image(systemName: "plus.circle")
.font(.system(size: Spacing.large, weight: .bold))
.foregroundColor(Color("DarkestPurple"))
Text("Add Task")
.font(Font.custom("NotoSansOriya", size: Spacing.medium))
.foregroundColor(Color("DarkestPurple"))
.baselineOffset(-5)
}
.padding(12.0)
.background(Color.cPink)
.cornerRadius(Spacing.medium)


// Add Task Button
Button {
viewModel.navigateAddTask()

} label: {
Image(systemName: "plus.circle")
.font(.system(size: Spacing.large, weight: .bold))
.foregroundColor(Color("DarkestPurple"))
Text("Add Task")
.font(Font.custom("NotoSansOriya", size: Spacing.medium))
.foregroundColor(Color("DarkestPurple"))
.baselineOffset(-5)
}



.padding(12.0)
.background(Color.cPink)
.cornerRadius(Spacing.medium)

}
.padding(Spacing.spacious)
.background(Color("Rose"))

}
.padding(Spacing.spacious)
.background(Color("Rose"))

}
}

//#Preview {
// #Preview {
// AboutPageView()
//}
// }
Loading

0 comments on commit e07e173

Please sign in to comment.