Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fassko/whirligig
https://github.com/fassko/whirligig
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fassko/whirligig
- Owner: fassko
- Created: 2020-04-10T17:39:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-11T22:34:08.000Z (over 4 years ago)
- Last Synced: 2024-10-14T15:02:17.185Z (3 months ago)
- Language: Swift
- Size: 1.08 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Whirligig
> Please write an app which uses RxSwift, aggregates data from sensors (like gyroscope), gets system info and displays it. No fancy UI is expected, but having good UX would be nice.
## Running the app
Open `Whirligig.xcodeproj` and allow for 3rd party dependancies to download with SwiftPM.
There are two schemes:
* `Whirligig` - run this on physical device
* `Whirligig-mock` - you can run this on Simulator, to mock the Gyroscope changes## Tests
Scheme `Whirligig` has some tests to test ViewModel behaviour.
## Challanges
Biggest challange was to get `CoreMotion` working with RxSwift because there can be only one instance per app. I found out solution from [Github](https://github.com/e-sites/RxSwiftly/blob/master/Source/CoreMotion/CMMotionManager/CMMotionManager%2Brx.swift) and from [RxCoreMotion](https://github.com/RxSwiftCommunity/RxCoreMotion) library code. Idea is using memoize to persist the same instance of `CMMotionManager`.
Second challange was to use 3D effect for `UIImageView`.
### Resources
* [Core Motion docs](https://developer.apple.com/documentation/coremotion)
* [NSHipster article](https://nshipster.com/cmdevicemotion/)
* [RxSwift CoreMotion implementation](https://github.com/e-sites/RxSwiftly/blob/master/Source/CoreMotion/CMMotionManager/CMMotionManager%2Brx.swift)
* [UIImageView 3D transform](https://stackoverflow.com/questions/56753665/swift-3d-rotation-of-uiimageview-cgaffinetransform-or-catransform3d)