Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 74 additions & 73 deletions BodyweightFitness.xcodeproj/project.pbxproj
100755 → 100644

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion BodyweightFitness/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

Fabric.with([Crashlytics.self])

Expand Down
2 changes: 1 addition & 1 deletion BodyweightFitness/BodyweightFitness.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>io.mazur.Bodyweight-Fitness</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion BodyweightFitness/Controller/Cell/CellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AnimationClass {
withDuration: 0.5,
delay: 0, usingSpringWithDamping: 0.3,
initialSpringVelocity: 0.1,
options: UIViewAnimationOptions.beginFromCurrentState,
options: UIView.AnimationOptions.beginFromCurrentState,
animations: {
view.transform = CGAffineTransform(scaleX: 1, y: 1)
},
Expand Down
12 changes: 6 additions & 6 deletions BodyweightFitness/Controller/Cell/DashboardDoubleItemCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class DashboardDoubleItemCell: UITableViewCell {

if let exercise = newValue {
if (exercise.isTimed()) {
self.leftButton.setImage(UIImage(named: "timed"), for: UIControlState())
self.leftButton.setImage(UIImage(named: "timed"), for: UIControl.State())
} else {
self.leftButton.setImage(UIImage(named: "weighted"), for: UIControlState())
self.leftButton.setImage(UIImage(named: "weighted"), for: UIControl.State())
}
}
}
Expand All @@ -42,9 +42,9 @@ class DashboardDoubleItemCell: UITableViewCell {

if let exercise = newValue {
if (exercise.isTimed()) {
self.rightButton.setImage(UIImage(named: "timed"), for: UIControlState())
self.rightButton.setImage(UIImage(named: "timed"), for: UIControl.State())
} else {
self.rightButton.setImage(UIImage(named: "weighted"), for: UIControlState())
self.rightButton.setImage(UIImage(named: "weighted"), for: UIControl.State())
}
}
}
Expand All @@ -67,11 +67,11 @@ class DashboardDoubleItemCell: UITableViewCell {
super.setSelected(selected, animated: animated)
}

func onLeftClick(_ sender: UITapGestureRecognizer) {
@objc func onLeftClick(_ sender: UITapGestureRecognizer) {
self.dashboardViewController?.dismissWithExercise(leftExercise!)
}

func onRightClick(_ sender: UITapGestureRecognizer) {
@objc func onRightClick(_ sender: UITapGestureRecognizer) {
self.dashboardViewController?.dismissWithExercise(rightExercise!)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class DashboardSingleItemCell: UITableViewCell {

if let exercise = newValue {
if (exercise.isTimed()) {
self.button.setImage(UIImage(named: "timed"), for: UIControlState())
self.button.setImage(UIImage(named: "timed"), for: UIControl.State())
} else {
self.button.setImage(UIImage(named: "weighted"), for: UIControlState())
self.button.setImage(UIImage(named: "weighted"), for: UIControl.State())
}
}
}
Expand All @@ -38,7 +38,7 @@ class DashboardSingleItemCell: UITableViewCell {
super.setSelected(selected, animated: animated)
}

func onClick(_ sender: UITapGestureRecognizer) {
@objc func onClick(_ sender: UITapGestureRecognizer) {
self.dashboardViewController?.dismissWithExercise(exercise!)
}
}
2 changes: 1 addition & 1 deletion BodyweightFitness/Controller/DashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class DashboardViewController: UIViewController, UITableViewDelegate, UITableVie
return 150
}

func dismissAnimated(_ sender: UIBarButtonItem) {
@objc func dismissAnimated(_ sender: UIBarButtonItem) {
self.dismiss(animated: true, completion: nil)
}

Expand Down
48 changes: 24 additions & 24 deletions BodyweightFitness/Controller/Modal/LogWorkoutController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LogWorkoutController: UIViewController {

var parentController: UIViewController?

func increaseRepsButtonDown(_ sender: AnyObject) {
@objc func increaseRepsButtonDown(_ sender: AnyObject) {
self.invalidateTimer(sender)

increaseReps()
Expand All @@ -61,7 +61,7 @@ class LogWorkoutController: UIViewController {
repeats: true)
}

func decreaseRepsButtonDown(_ sender: AnyObject) {
@objc func decreaseRepsButtonDown(_ sender: AnyObject) {
self.invalidateTimer(sender)

decreaseReps()
Expand All @@ -74,7 +74,7 @@ class LogWorkoutController: UIViewController {
repeats: true)
}

func increaseWeightButtonDown(_ sender: AnyObject) {
@objc func increaseWeightButtonDown(_ sender: AnyObject) {
self.invalidateTimer(sender)

increaseWeight()
Expand All @@ -87,7 +87,7 @@ class LogWorkoutController: UIViewController {
repeats: true)
}

func decreaseWeightButtonDown(_ sender: AnyObject) {
@objc func decreaseWeightButtonDown(_ sender: AnyObject) {
self.invalidateTimer(sender)

decreaseWeight()
Expand All @@ -100,7 +100,7 @@ class LogWorkoutController: UIViewController {
repeats: true)
}

func invalidateTimer(_ sender: AnyObject) {
@objc func invalidateTimer(_ sender: AnyObject) {
increaseRepsTimer?.invalidate()
decreaseRepsTimer?.invalidate()

Expand All @@ -119,12 +119,12 @@ class LogWorkoutController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let controlEvents: UIControlEvents = [
UIControlEvents.touchUpInside,
UIControlEvents.touchUpOutside,
UIControlEvents.touchDragOutside,
UIControlEvents.touchDragExit,
UIControlEvents.touchCancel
let controlEvents: UIControl.Event = [
UIControl.Event.touchUpInside,
UIControl.Event.touchUpOutside,
UIControl.Event.touchDragOutside,
UIControl.Event.touchDragExit,
UIControl.Event.touchCancel
]

self.increaseRepsButton.addTarget(
Expand Down Expand Up @@ -179,9 +179,9 @@ class LogWorkoutController: UIViewController {
self.actionView?.isHidden = true

self.verticalStackView = UIStackView()
self.verticalStackView?.axis = UILayoutConstraintAxis.vertical;
self.verticalStackView?.distribution = UIStackViewDistribution.equalSpacing;
self.verticalStackView?.alignment = UIStackViewAlignment.center;
self.verticalStackView?.axis = NSLayoutConstraint.Axis.vertical;
self.verticalStackView?.distribution = UIStackView.Distribution.equalSpacing;
self.verticalStackView?.alignment = UIStackView.Alignment.center;
self.verticalStackView?.spacing = 8;

self.verticalStackView?.translatesAutoresizingMaskIntoConstraints = false
Expand Down Expand Up @@ -216,9 +216,9 @@ class LogWorkoutController: UIViewController {
func addHorizontalStackViewIfNeeded() {
if(numberOfSetViews == 0 || numberOfSetViews == 3 || numberOfSetViews == 6 || numberOfSetViews == 9) {
self.horizontalStackView = UIStackView()
self.horizontalStackView?.axis = UILayoutConstraintAxis.horizontal;
self.horizontalStackView?.distribution = UIStackViewDistribution.equalSpacing;
self.horizontalStackView?.alignment = UIStackViewAlignment.center;
self.horizontalStackView?.axis = NSLayoutConstraint.Axis.horizontal;
self.horizontalStackView?.distribution = UIStackView.Distribution.equalSpacing;
self.horizontalStackView?.alignment = UIStackView.Alignment.center;
self.horizontalStackView?.spacing = 8;

self.horizontalStackView?.translatesAutoresizingMaskIntoConstraints = false
Expand All @@ -227,7 +227,7 @@ class LogWorkoutController: UIViewController {
}
}

func pressed(_ setView: SetView!) {
@objc func pressed(_ setView: SetView!) {
showActionView(setView)
}

Expand Down Expand Up @@ -400,7 +400,7 @@ class LogWorkoutController: UIViewController {
}
}

func increaseReps() {
@objc func increaseReps() {
try! realm.write {
if let set = set {
if set.isTimed {
Expand All @@ -425,7 +425,7 @@ class LogWorkoutController: UIViewController {
}
}

func decreaseReps() {
@objc func decreaseReps() {
try! realm.write {
if let set = set {
if set.isTimed {
Expand All @@ -448,7 +448,7 @@ class LogWorkoutController: UIViewController {
}
}

func increaseWeight() {
@objc func increaseWeight() {
try! realm.write {
if let set = set {
if set.isTimed {
Expand All @@ -473,7 +473,7 @@ class LogWorkoutController: UIViewController {
}
}

func decreaseWeight() {
@objc func decreaseWeight() {
try! realm.write {
if let set = set {
if set.isTimed {
Expand Down Expand Up @@ -528,8 +528,8 @@ class SetView: UIButton {
layer.borderColor = UIColor(red:0, green:0.27, blue:0.24, alpha:1).cgColor
layer.backgroundColor = UIColor.white.cgColor

setTitleColor(tintColor, for: UIControlState())
setTitleColor(UIColor.white, for: UIControlState.selected)
setTitleColor(tintColor, for: UIControl.State())
setTitleColor(UIColor.white, for: UIControl.State.selected)
}

func customizeAppearance() {
Expand Down
8 changes: 4 additions & 4 deletions BodyweightFitness/Domain/RepositoryCategory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import Foundation
import RealmSwift

class RepositoryCategory: Object {
dynamic var id = "Category-" + UUID().uuidString
dynamic var categoryId = ""
dynamic var title = ""
dynamic var routine: RepositoryRoutine?
@objc dynamic var id = "Category-" + UUID().uuidString
@objc dynamic var categoryId = ""
@objc dynamic var title = ""
@objc dynamic var routine: RepositoryRoutine?

let sections = List<RepositorySection>()
let exercises = List<RepositoryExercise>()
Expand Down
18 changes: 9 additions & 9 deletions BodyweightFitness/Domain/RepositoryExercise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import Foundation
import RealmSwift

class RepositoryExercise: Object {
dynamic var id = "Exercise-" + UUID().uuidString
dynamic var exerciseId = ""
dynamic var title = ""
dynamic var desc = ""
dynamic var defaultSet = ""
dynamic var visible = true
dynamic var routine: RepositoryRoutine?
dynamic var category: RepositoryCategory?
dynamic var section: RepositorySection?
@objc dynamic var id = "Exercise-" + UUID().uuidString
@objc dynamic var exerciseId = ""
@objc dynamic var title = ""
@objc dynamic var desc = ""
@objc dynamic var defaultSet = ""
@objc dynamic var visible = true
@objc dynamic var routine: RepositoryRoutine?
@objc dynamic var category: RepositoryCategory?
@objc dynamic var section: RepositorySection?

let sets = List<RepositorySet>()

Expand Down
12 changes: 6 additions & 6 deletions BodyweightFitness/Domain/RepositoryRoutine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Foundation
import RealmSwift

class RepositoryRoutine: Object {
dynamic var id = "Routine-" + UUID().uuidString
dynamic var routineId = ""
dynamic var title = ""
dynamic var subtitle = ""
dynamic var startTime = Date()
dynamic var lastUpdatedTime = Date()
@objc dynamic var id = "Routine-" + UUID().uuidString
@objc dynamic var routineId = ""
@objc dynamic var title = ""
@objc dynamic var subtitle = ""
@objc dynamic var startTime = Date()
@objc dynamic var lastUpdatedTime = Date()

let categories = List<RepositoryCategory>()
let sections = List<RepositorySection>()
Expand Down
12 changes: 6 additions & 6 deletions BodyweightFitness/Domain/RepositorySection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Foundation
import RealmSwift

class RepositorySection: Object {
dynamic var id = "Section-" + UUID().uuidString
dynamic var sectionId = ""
dynamic var title = ""
dynamic var mode = ""
dynamic var routine: RepositoryRoutine?
dynamic var category: RepositoryCategory?
@objc dynamic var id = "Section-" + UUID().uuidString
@objc dynamic var sectionId = ""
@objc dynamic var title = ""
@objc dynamic var mode = ""
@objc dynamic var routine: RepositoryRoutine?
@objc dynamic var category: RepositoryCategory?

let exercises = List<RepositoryExercise>()

Expand Down
12 changes: 6 additions & 6 deletions BodyweightFitness/Domain/RepositorySet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import Foundation
import RealmSwift

class RepositorySet: Object {
dynamic var id = "Set-" + UUID().uuidString
dynamic var isTimed = false
dynamic var weight = 0.0
dynamic var reps = 0
dynamic var seconds = 0
dynamic var exercise: RepositoryExercise?
@objc dynamic var id = "Set-" + UUID().uuidString
@objc dynamic var isTimed = false
@objc dynamic var weight = 0.0
@objc dynamic var reps = 0
@objc dynamic var seconds = 0
@objc dynamic var exercise: RepositoryExercise?

override static func primaryKey() -> String? {
return "id"
Expand Down
4 changes: 2 additions & 2 deletions BodyweightFitness/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ extension UIColor {
extension UIViewController {
func setNavigationBar() {
let titleDict: NSDictionary = [
NSForegroundColorAttributeName: UIColor(red:0, green:0.27, blue:0.24, alpha:1)
NSAttributedString.Key.foregroundColor: UIColor(red:0, green:0.27, blue:0.24, alpha:1)
]

self.navigationController?.navigationBar.barTintColor = UIColor(red:0, green:0.59, blue:0.53, alpha:1)
self.navigationController?.navigationBar.titleTextAttributes = titleDict as? [String : AnyObject]
self.navigationController?.navigationBar.titleTextAttributes = titleDict as? [NSAttributedString.Key : AnyObject]
self.navigationController?.navigationBar.isTranslucent = false
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.setBackgroundImage(
Expand Down
8 changes: 4 additions & 4 deletions BodyweightFitness/Main/CalendarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class CalendarViewController: AbstractViewController, MFMailComposeViewControlle
let csv = companion.csv(weightUnit: weightUnit)
let csvName = companion.csvName()

let emailViewController = configuredMailComposeViewController(subject: subject, messageBody: body, csv: data, csvName: csvName)
let emailViewController = configuredMailComposeViewController(subject: subject, messageBody: body, csv: csv, csvName: csvName)
self.present(emailViewController, animated: true, completion: nil)
}

Expand All @@ -202,21 +202,21 @@ class CalendarViewController: AbstractViewController, MFMailComposeViewControlle
let alertController = UIAlertController(
title: "Remove Workout",
message: "Are you sure you want to remove this workout?",
preferredStyle: UIAlertControllerStyle.alert
preferredStyle: UIAlertController.Style.alert
)

alertController.addAction(
UIAlertAction(
title: "Cancel",
style: UIAlertActionStyle.cancel,
style: UIAlertAction.Style.cancel,
handler: nil
)
)

alertController.addAction(
UIAlertAction(
title: "Remove",
style: UIAlertActionStyle.destructive,
style: UIAlertAction.Style.destructive,
handler: { (action: UIAlertAction!) in
let realm = try! Realm()

Expand Down
Loading