Skip to content

πŸ’ͺ🏿 This is MaeumGaGym's exclusive health library πŸ‘ŠπŸΏ

Notifications You must be signed in to change notification settings

MaeumGaGym/MindGymKit

Repository files navigation

MindGymKit

πŸ’ͺ🏿 v0.2.4

This library was created to easily manage health-related functions.

Installation

Carthage

Add the following entry to your Cartfile:

preparing πŸ™

CocoaPods

Add the following entry to your Podfile:

preparing πŸ™

Then run pod install

Swift Package Manager

To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:

https://github.com/MaeumGajim/MindGymKit.git

Usage

Info.plist πŸ“„

  • How to allow camera access:

    // Message explaining why the app requested permission to read samples from the HealthKit store.
    Privacy - Health Share Usage Description βš“οΈ
  • How to allow album access:

    // Message explaining why the app requested permission to save samples to the HealthKit store.
    Privacy - Health Update Usage Description 🦾

⚠️ Don't forget to fill in the value ⚠️

MindGymKit

  • Get today's number of steps:

    let mindGym = MindGymKit()
    
    mindGym.fetchTodayStepCount { stepCount in
         DispatchQueue.main.async {
             if let stepCount = stepCount {
                    print("todayStep: \(stepCount)")
                } else {
                    print("Error")
                }
            }
      }
  • Using a stopwatch:

    let stopwatch = MindGymStopWatchKit()
    
    stopwatch.mainStopwatch.timeUpdate
        .observe(on: MainScheduler.instance)
        .subscribe(onNext: { [weak self] timeString in
            self?.stopWatchLabel.text = timeString
        })
        .disposed(by: disposeBag)
        
    stopwatch.mainStopwatch.recordUpdate
        .observe(on: MainScheduler.instance)
        .subscribe(onNext: { [weak self] lapTimes in
            self?.lapRecords = lapTimes
            self?.lapRecords.append(lapTimes.last ?? "")
            print("Lap record : \(String(describing: self?.lapRecords ?? nil))")
        })
        .disposed(by: disposeBag)

About

πŸ’ͺ🏿 This is MaeumGaGym's exclusive health library πŸ‘ŠπŸΏ

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages