-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jhrcook/watch-app
Watch app
- Loading branch information
Showing
65 changed files
with
2,542 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// KeyboardDismiss-extension.swift | ||
// WaterMe | ||
// | ||
// Created by Joshua on 8/1/20. | ||
// Copyright © 2020 Joshua Cook. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
#if canImport(UIKit) | ||
extension View { | ||
func hideKeyboard() { | ||
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil) | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// UIImage-extension.swift | ||
// WaterMe | ||
// | ||
// Created by Joshua on 8/24/20. | ||
// Copyright © 2020 Joshua Cook. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
|
||
extension UIImage { | ||
func resized(withPercentage percentage: CGFloat, isOpaque: Bool = true) -> UIImage? { | ||
let canvas = CGSize(width: size.width * percentage, height: size.height * percentage) | ||
let format = imageRendererFormat | ||
format.opaque = isOpaque | ||
return UIGraphicsImageRenderer(size: canvas, format: format).image { | ||
_ in draw(in: CGRect(origin: .zero, size: canvas)) | ||
} | ||
} | ||
func resized(toWidth width: CGFloat, isOpaque: Bool = true) -> UIImage? { | ||
let canvas = CGSize(width: width, height: CGFloat(ceil(width/size.width * size.height))) | ||
let format = imageRendererFormat | ||
format.opaque = isOpaque | ||
return UIGraphicsImageRenderer(size: canvas, format: format).image { | ||
_ in draw(in: CGRect(origin: .zero, size: canvas)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.