DiveKit
The development of DiveKit started to fulfill the need for diving calculations in the ongoing rewrite of my iOS application, Guam Dive Guide. My goal for DiveKit is to be a robust library of scuba diving calculations.
I will continue to develop this codebase to include more calculations and refactor code to provide the most accurate calculations with syntax that is both easy to use and easy to understand.
Initialization
import UIKit
import DiveKit
class ViewController: UIViewController {
var diveKit: DiveKit!
override func viewDidLoad() {
super.viewDidLoad()
// Initialize diveKit with default values of salt water and imperial units
diveKit = DiveKit.default
// Initialize diveKit with fresh water and metric units
diveKit = DiveKit.init(waterType: .freshWater, measurementUnit: .metric)
// Initialize diveKit with water type of fresh water and default value of imperial
diveKit = DiveKit.init(waterType: .freshWater)
// Initialize diveKit with metric measurements and default water type of salt water
diveKit = DiveKit.init(measurementUnit: .metric)
}
}
Usage
Calculate MOD of an Enriched Air Nitrox (EANx) Blend
import DiveKit
// Calclate MOD for EANx32 at PPO2 of 1.4 (Salt Water and Imperial Units)
let enrichedAirCalc = DKEnrichedAir.init(waterType: .saltWater, measurementUnit: .imperial)
do {
let gas = try Gas.enrichedAir(32)
let mod = try enrichedAirCalc.maximumOperatingDepth(fractionOxygen: 1.4, gas: gas)
print(mod) // 111 (feet)
} catch {
// Handle Error
print(error.localizedDescription)
}
Installation
CocoaPods
DiveKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'DiveKit', '~> 0.11.0'
Swift Package Manager with Xcode 11
Add the following line to the dependencies in your Package.swift
file:
.package(url: "https://github.com/jaytrisw/DiveKit.git", from: "0.11.0"),
…and then include "DiveKit"
as a dependency for your executable target:
.product(name: "DiveKit", package: "DiveKit"),
Note: Because
DiveKit
is under active development, source-stability will only guaranteed after the release of version1.0
, breaking changes may occur until then.
Author
Joshua T. Wood joshuatw@gmail.com | @joshuatw
License
DiveKit is available under the MIT license. See the LICENSE file for more info.