Count It, Never lose the count again

Overview

Banner Build Status codecov.io GitHub license

DownloadAppStore

Count It

Never lose the count again. Dead simple App with Apple Watch integration that lets you count anything.

  • Laps while exercising.
  • How many beers you drink at the pub.
  • Days since you quit smoking.
  • Glasses of water you drink during the day.
  • People that enter your restaurant or club.
  • Sheep while you sleep 😜

Count It has two way communication between the App and the Watch, meaning that you can start your count on your Watch and continue it on your Phone and vice versa.

Tapping anywhere on the App or Watch face adds to the counter and gives you haptic feedback. You don't have to look at your Watch while counting!

To decrement or clear the counter, force press on your watch face.

Includes a watch complication and glance that lets you easily check and access the count.

You can also modify the look to several color options to fit your style.

The step count can also be modify so you can count in higher numbers not just one by one.

Screenshots

Watch Screenshots

The Code

Installation

This project comes with a Makefile to simplify the onboarding of the project.

To bootstrap the project just clone the repo, navigate to the root directory on terminal and run the following command:

make bootstrap

This will install all the gems specified in the Gemfile as well as installing all the dependencies specified by the Podfile.

In case bundler is not detected the Makefile target will fail.

There are multiple targets supported by the Makefile which can be easily know by running:

make help

Details

The idea of the app was to play with WatchKit 2 and try to create something in a couple of days.

Perhaps, one of the most interesting parts its the two way communication between the App and the Watch.

TwoWayCommunication

All of these is wrapped into the WatchSessionManager.swift.

ApplicationContextChangedDelegate is use as a delegate pattern to let other objects 'register' to events from the WCSession.

//Add view model to the datasource delegate so we get application context changes
       watchSession.addDataSourceChangedDelegate(self)

This is the only thing something like a ViewModel will need to register to these events.

View Models

MVVM is use throughout the app. All of this ViewModels classes are shared along the iOS and Watch targets.

This makes it extremely easy to setup things like Glances and Interface Controllers in the WatchKit side of things.

All ViewModels expose RxSwift observables in the form of Drivers that are perfect to use in ViewModels because they:

  • can't error out
  • observe on main scheduler
  • sharing side effects (shareReplayLatestWhileConnected)

ViewControllers can later connect to this drivers and update UI Elements, for example:

viewModel.clickerCountDriver?
         .map { $0.description }
         .driveNext{ [weak self] count in

          self?.updateCountLabelWithAnimation(count)

         }.addDisposableTo(disposeBag)

This will update the counter label with an animation to latest information.

Data Storage

NSUserDefault is use as the Datastore since the data is really simple. All Model objects implement NSCoding and are saved by using the NSKeyedArchiver.

let data = NSKeyedArchiver.archivedDataWithRootObject(object)

defaults.setObject(data, forKey: key)

defaults.synchronize()

Protocols

There are several protocols like Dictionable and Timeable that encapsulates some good amount of functionality, making it very easy update models objects.

TODO

  • Set a Goal of counts, so you know when you are near your Goal.
  • Better code coverage
  • Improve animations on Watch
  • Watch UI Testing (Not supported by Apple)

👽 Author

Chris Jimenez - http://code.chrisjimenez.net, @chrisjimeneznat

🍺 Donate

If you want to buy me a beer, you can donate to my coin addresses below:

BTC

1BeGBew4CBdLgUSmvoyiU1LrM99GpkXgkj

ETH

0xa59a3793E3Cb5f3B1AdE6887783D225EDf67192d

LTC

Ld6FB3Tqjf6B8iz9Gn9sMr7BnowAjSUXaV

License

Count It is released under the MIT license. See LICENSE for details.

You might also like...
Reliable Server Side Swift ✭ Make Apache great again!
Reliable Server Side Swift ✭ Make Apache great again!

mod_swift mod_swift is a technology demo which shows how to write native modules for the Apache Web Server in the Swift 3 programming language. The de

StatusBarOverlay will automatically show a
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again

StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

An app to count down the days until upcoming milestones.
An app to count down the days until upcoming milestones.

Milestones An app to count down the days until upcoming milestones. We all have something to look forward to. Built to try out the Swift Composable Ar

An app to count stitches in crochet patterns. Multiplatform.
An app to count stitches in crochet patterns. Multiplatform.

An app to count your crochet patterns' stitches! Made with 100% SwiftUI, no UIKit, and no 3rd party dependencies. Powered by regular expressions. Down

Simple library to detect motion type (walking, running, automotive) and count users steps. This library will make motion detection much more easily.
Simple library to detect motion type (walking, running, automotive) and count users steps. This library will make motion detection much more easily.

SOMotionDetector Simple library to detect motion for iOS by arturdev . Based on location updates and acceleration. ###Requierments iOS 6.0 Compatibl

Nice category that adds the ability to set the retry interval, retry count and progressiveness.
Nice category that adds the ability to set the retry interval, retry count and progressiveness.

If a request timed out, you usually have to call that request again by yourself. AFNetworking+RetryPolicy is an objective-c category that adds the abi

Cardshark is an iOS card counting App that uses state of the art machine learning (YOLO) to classify and count the cards at real time.

Cardshark The game of Blackjack is one of the most popular casino games in the world. It is also the most winnable using a skill called Card Counting.

An `NSTextField` that specifies a maximum count after which text is highlighted to indicate an overflow
An `NSTextField` that specifies a maximum count after which text is highlighted to indicate an overflow

DSFMaxLengthDisplayTextField An NSTextField that specifies a maximum count after which text is highlighted to indicate an overflow Why? I always liked

Comments
  • Added `Makefile`

    Added `Makefile`

    Added a Makefile to simplify onboarding of the project.

    Just by running:

    make bootstrap
    

    The Makefile will check that bundler is installed, then will proceed to download the required gems and after that will execute pod install using the gem from the bundle.

    Added some details in the README as well

    opened by esttorhe 2
  • Add UI testing to compare color change

    Add UI testing to compare color change

    Figure out a way to check if the switch and buttons that change colors are actually changing the colors on screen.

    Maybe taking a screenshot and then doing an image comparison might be worth it.

    Although this would also require adding some custom matchers for XCUITests

    enhancement help wanted 
    opened by esttorhe 3
Owner
Chris Jimenez
I build Apps for your phone and tablets, also 📸, from 🇨🇷, in 🇩🇪
Chris Jimenez
An app to count stitches in crochet patterns. Multiplatform.

An app to count your crochet patterns' stitches! Made with 100% SwiftUI, no UIKit, and no 3rd party dependencies. Powered by regular expressions. Down

Zheng 9 Oct 24, 2022
🗂 Never use NSSearchPathForDirectoriesInDomains again

AppFolder AppFolder is a lightweight framework that lets you design a friendly, strongly-typed representation of a directories inside your app's conta

Oleg Dreyman 935 Dec 16, 2022
compiler-driven, structured, type-safe source generation. never use gyb again!

factory 2022-09-10-a factory is a structured, type-safe source generation tool. It is intended to be a replacement for (and improvement over) the gyb

taylorswift 14 Dec 8, 2022
Rock - Paper - Scissors game. CPU gives you a sign and asks to win or lose your move. Than you have to decide witch sign do you choose to score a point

RockPaperScissors 2nd challange from HackingWithSwift.com. The CPU gives you a sign (rock, paper or scissors) and asks you either to win or to lose th

Pavel Surový 0 Nov 27, 2021
Brain training Rock, Paper, Scissors game where user must purposefully win or lose against computer

RockPaperScissors This is a Rock, Paper, Scissors game that includes an addition

Bogdan Alex Ciobanu 0 Dec 18, 2021
JSONNeverDie - Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die

JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very important part of Pitaya.

John Lui 454 Oct 30, 2022
Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die

JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very imp

John Lui 454 Oct 30, 2022
An application focused on managing men's haircuts. It has never been so easy to keep the cut on time

An application focused on managing men's haircuts. It has never been so easy to keep the cut on time

Yago Marques 2 Oct 13, 2022
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

StatusBarOverlay StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It support

Idle Hands Apps 160 Nov 2, 2022
Log every incoming notification to view them again later, also includes attachments and advanced settings to configure

Vē Natively integrated notification logger Installation Add this repository to your package manager

alexandra 43 Dec 25, 2022