Giter Site home page Giter Site logo

expensetracker's Introduction

expenseTracker

expense tracker iphone + watch app built in like 11 hours some random saturday (edit: +another 2 hours on sunday). thanks to swiftui for making things fast to build, but also no thanks to swiftui for causing headaches with updating data and stuff. at least now i can say i sort of understand the update model in swift - enough to hack my things to work.

target

i made this in Xcode Version 14.3.1 (14E300c) in June 10&11, 2023. So whatever version of Swift/iOS/watchOS was out at the time is the version I targeted (iOS 16 I think). Sorry if you're on an older version.

how does it work?

libraries/stuff used:

  • SwiftUI: yeah on the tin it does use SwiftUI but probably not in very "good" ways. Still might be fun to look through the code (see ContentView.swift files in the app itself + watch app) to laugh at it, though.
  • WatchConnectivity: probably a decent example of how to use this library tbh. I do things the "right" way, I think. See WatchCommunication.swift for the bulk of this code. The phone sends an application context (containing the list of categories for expenses) to the watch (which is stored in a currentvaluesubject from combine) by serializing a data structure into JSON (was unable to get it working just sending the data structure itself). This is cool because it means the watch app doesn't need to be open at the time of the sending. The watch sends messages to the phone app (containing data on each expense that gets added through the watch app), formatted as JSON again, which i think wakes up the phone app in the background or something like that in order to process the requests, which is good.
  • Combine: i use PassthroughSubject and CurrentValueSubject a bit as part of WatchCommunication.swift. I think it's a reasonably sane usage of it.
  • CoreData: again, on paper i technically use coredata, but not really in a super proper way, probably.

swift code is generally pretty self-documenting imo, but i do have a few misc comments scattered around if you do choose to go reading through.

oh also i made a numpad entry for the watch that is in its own separate file (WatchNumpadView.swift) if it's helpful for anyone.

does it work?

untested on real devices because my watch auto-updated to the latest watchos which i unfortunately do not have the device support package for right now :/ but on the phone it seems to work fine enough:

image image image

expensetracker's People

Contributors

ohnx avatar

Stargazers

 avatar

Watchers

 avatar

expensetracker's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.