Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tybrandt
iOS Budget Tracker
Commits
94fc4dc6
Commit
94fc4dc6
authored
Apr 08, 2021
by
tybrandt
Browse files
Delete functionality implemented
parent
b337c3a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Budget Tracker.xcodeproj/project.xcworkspace/xcuserdata/tybrandt.xcuserdatad/UserInterfaceState.xcuserstate
View file @
94fc4dc6
No preview for this file type
Budget Tracker/Base.lproj/Main.storyboard
View file @
94fc4dc6
...
...
@@ -147,14 +147,14 @@
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<prototypes>
<tableViewCell
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
preservesSuperviewLayoutMargins=
"YES"
selectionStyle=
"default"
indentationWidth=
"10"
reuseIdentifier=
"allTransactions"
id=
"e68-D8-BFK"
customClass=
"TransactionTableViewCell"
customModule=
"Budget_Tracker"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"28"
width=
"414"
height=
"4
4
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"28"
width=
"414"
height=
"4
3.5
"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
preservesSuperviewLayoutMargins=
"YES"
insetsLayoutMarginsFromSafeArea=
"NO"
tableViewCell=
"e68-D8-BFK"
id=
"Q12-f8-IYE"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"4
4
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"4
3.5
"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Label"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ZQh-dN-pAc"
>
<rect
key=
"frame"
x=
"20"
y=
"11"
width=
"42"
height=
"21
.5
"
/>
<rect
key=
"frame"
x=
"20"
y=
"11"
width=
"42"
height=
"21"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<nil
key=
"textColor"
/>
<nil
key=
"highlightedColor"
/>
...
...
@@ -221,11 +221,16 @@
<barButtonItem
key=
"rightBarButtonItem"
title=
"Confirm"
id=
"foO-CN-S4s"
>
<connections>
<action
selector=
"confirm:"
destination=
"2i0-KG-j1T"
id=
"Ubw-cj-tI6"
/>
<segue
destination=
"b7c-FZ-HVQ"
kind=
"unwind"
unwindAction=
"deleteDataWithSender:"
id=
"FNS-Z8-p7X"
/>
</connections>
</barButtonItem>
</navigationItem>
<connections>
<outlet
property=
"confirmButton"
destination=
"foO-CN-S4s"
id=
"7pi-si-SMG"
/>
</connections>
</viewController>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"qmn-NT-Tu8"
userLabel=
"First Responder"
customClass=
"UIResponder"
sceneMemberID=
"firstResponder"
/>
<exit
id=
"b7c-FZ-HVQ"
userLabel=
"Exit"
sceneMemberID=
"exit"
/>
</objects>
<point
key=
"canvasLocation"
x=
"2811.594202898551"
y=
"906.69642857142856"
/>
</scene>
...
...
Budget Tracker/CategoryViewController.swift
View file @
94fc4dc6
...
...
@@ -51,6 +51,17 @@ class CategoryViewController: UIViewController, UITableViewDelegate, UITableView
}
}
@IBAction
func
deleteData
(
sender
:
UIStoryboardSegue
)
{
if
let
sourceView
=
sender
.
source
as?
DeletionViewController
{
if
sourceView
.
confirmed
{
categories
=
[
Category
]()
}
saveCategories
()
categoryTable
.
reloadData
()
totalLabel
.
text
=
"Total: $0.00"
}
}
override
func
prepare
(
for
segue
:
UIStoryboardSegue
,
sender
:
Any
?)
{
super
.
prepare
(
for
:
segue
,
sender
:
sender
)
switch
(
segue
.
identifier
??
""
)
{
...
...
Budget Tracker/DeletionViewController.swift
View file @
94fc4dc6
...
...
@@ -8,13 +8,17 @@
import
UIKit
class
DeletionViewController
:
UIViewController
{
var
confirmed
=
false
@IBOutlet
weak
var
confirmButton
:
UIBarButtonItem
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
}
@IBAction
func
confirm
(
_
sender
:
UIBarButtonItem
)
{
dismiss
(
animated
:
true
,
completion
:
nil
)
override
func
prepare
(
for
segue
:
UIStoryboardSegue
,
sender
:
Any
?)
{
super
.
prepare
(
for
:
segue
,
sender
:
sender
)
guard
let
button
=
sender
as?
UIBarButtonItem
,
button
===
confirmButton
else
{
return
}
confirmed
=
true
}
@IBAction
func
cancel
(
_
sender
:
UIBarButtonItem
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment