Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

Commit

Permalink
Switch to BAFluidView
Browse files Browse the repository at this point in the history
  • Loading branch information
andreamazz committed Jul 13, 2015
1 parent 87242c0 commit 86b1fbe
Show file tree
Hide file tree
Showing 27 changed files with 97 additions and 46 deletions.
4 changes: 2 additions & 2 deletions Gulps/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import UIKit
import UIKit
import DPMeterView

@UIApplicationMain
Expand All @@ -25,7 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
UINavigationBar.appearance().barTintColor = .mainColor()
UINavigationBar.appearance().tintColor = .whiteColor()

Settings.registerDefaults()
Settings.registerDefaults()

let userDefaults = NSUserDefaults.groupUserDefaults()
if (!userDefaults.boolForKey(Settings.General.OnboardingShown.key())) {
Expand Down
17 changes: 14 additions & 3 deletions Gulps/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14E26a" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="49e-Tb-3d3">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="49e-Tb-3d3">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
Expand Down Expand Up @@ -29,11 +29,21 @@
<rect key="frame" x="0.0" y="64" width="320" height="455"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQX-uO-zkr" customClass="DPMeterView">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mQX-uO-zkr" customClass="UIImageView">
<rect key="frame" x="50" y="20" width="220" height="220"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gso-Wp-gIg" customClass="BAFluidView">
<rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="0.96052631578947367" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="width" secondItem="mQX-uO-zkr" secondAttribute="height" multiplier="1:1" id="KfC-cY-eVr"/>
<constraint firstItem="gso-Wp-gIg" firstAttribute="leading" secondItem="mQX-uO-zkr" secondAttribute="leading" id="Vkd-nk-EWI"/>
<constraint firstAttribute="trailing" secondItem="gso-Wp-gIg" secondAttribute="trailing" id="Wra-vm-nJh"/>
<constraint firstItem="gso-Wp-gIg" firstAttribute="top" secondItem="mQX-uO-zkr" secondAttribute="top" id="i7g-Fl-QF8"/>
<constraint firstAttribute="bottom" secondItem="gso-Wp-gIg" secondAttribute="bottom" id="pUr-pa-kmJ"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0%" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mEa-Xq-QB6" customClass="UICountingLabel">
Expand Down Expand Up @@ -164,7 +174,8 @@
<outlet property="largeButton" destination="v5a-2l-qvB" id="dvl-3k-q65"/>
<outlet property="minusButton" destination="uvx-n6-xp2" id="Id3-s0-QqO"/>
<outlet property="percentageLabel" destination="mEa-Xq-QB6" id="VWN-Gf-0ip"/>
<outlet property="progressMeter" destination="mQX-uO-zkr" id="wZK-do-o20"/>
<outlet property="progressMeter" destination="gso-Wp-gIg" id="Wvb-Hx-qae"/>
<outlet property="progressMeterBackground" destination="mQX-uO-zkr" id="IUE-xh-lf1"/>
<outlet property="smallButton" destination="rSl-zs-C7Z" id="Eb6-qX-fT4"/>
<outlet property="starButton" destination="xap-Vb-CbA" id="RjA-tl-1Yo"/>
</connections>
Expand Down
12 changes: 12 additions & 0 deletions Gulps/Images.xcassets/drop-bg.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "drop-bg.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions Gulps/Images.xcassets/drop.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "drop.pdf"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added Gulps/Images.xcassets/drop.imageset/drop.pdf
Binary file not shown.
38 changes: 28 additions & 10 deletions Gulps/ViewControllers/DrinkViewController.swift
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import UIKit
import DPMeterView
import BAFluidView
import UICountingLabel
import Realm
import BubbleTransition

public class DrinkViewController: UIViewController, UIAlertViewDelegate, UIViewControllerTransitioningDelegate {

@IBOutlet public weak var progressMeter: DPMeterView!
@IBOutlet public weak var progressMeterBackground: UIImageView!
@IBOutlet public weak var percentageLabel: UICountingLabel!
@IBOutlet public weak var addButton: UIButton!
@IBOutlet public weak var smallButton: UIButton!
@IBOutlet public weak var largeButton: UIButton!
@IBOutlet public weak var minusButton: UIButton!
@IBOutlet public var entryHandler: EntryHandler!
@IBOutlet weak var starButton: UIButton!
@IBOutlet public weak var progressMeter: BAFluidView!
public var userDefaults = NSUserDefaults.groupUserDefaults()
let mask = CALayer()
var expanded = false
var realmToken: RLMNotificationToken?
let transition = BubbleTransition()
Expand All @@ -28,29 +30,46 @@ public class DrinkViewController: UIViewController, UIAlertViewDelegate, UIViewC

percentageLabel.animationDuration = 1.5
percentageLabel.format = "%d%%";
progressMeter.startGravity()

realmToken = RLMRealm.defaultRealm().addNotificationBlock { note, realm in
self.updateUI()
}

progressMeterBackground.image = UIImage(named: "drop-bg")
progressMeterBackground.contentMode = .Center
progressMeterBackground.backgroundColor = .clearColor()

progressMeter.backgroundColor = .clearColor()
progressMeter.fillColor = .mainColor()

progressMeter.fillAutoReverse = false
progressMeter.fillRepeatCount = 0;
progressMeter.amplitudeIncrement = 1

if let image = UIImage(named: "drop") {
mask.contents = image.CGImage
progressMeter.layer.mask = mask
mask.frame = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
}

NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateUI", name: UIApplicationDidBecomeActiveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(progressMeter, selector: "stopAnimation", name: UIApplicationWillResignActiveNotification, object: nil)
}

public override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
progressMeter.setShape(ProgressMeter.pathFromRect(self.progressMeter.frame))
mask.frame = CGRect(x: (progressMeter.frame.size.width - mask.frame.size.width) / 2, y: (progressMeter.frame.size.height - mask.frame.size.height) / 2, width: mask.frame.size.width, height: mask.frame.size.height)
}

public override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
updateUI()

// animateStarButton()
}

public override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
public override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
progressMeter.stopAnimation()
}

func updateCurrentEntry(delta: Double) {
Expand All @@ -60,9 +79,8 @@ public class DrinkViewController: UIViewController, UIAlertViewDelegate, UIViewC
func updateUI() {
let percentage = self.entryHandler.currentEntry().percentage
percentageLabel.countFromCurrentValueTo(Float(round(percentage)))
if (!progressMeter.isAnimating) {
progressMeter.setProgress(CGFloat(percentage / 100.0), duration: 1.5)
}
progressMeter.fillTo(CGFloat(percentage / 100.0))
progressMeter.startAnimation()
}

override public func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
Expand Down
2 changes: 1 addition & 1 deletion GulpsTests/DrinkViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class DrinkViewControllerSpecs: QuickSpec {
describe("when the controller loads") {
it("should display the starting progress as 0%") {
expect(subject.percentageLabel.text).to(equal("0%"))
expect(subject.progressMeter.progress).to(equal(0))
// expect(subject.progressMeter.progress).to(equal(0))
}

it("should present an empty meter") {
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def common_pods
pod 'AMPopTip', '~> 0.7'
pod 'UICountingLabel', '~> 1.2'
pod 'JTCalendar', git: 'https://github.com/andreamazz/JTCalendar', branch: 'develop'
pod 'DPMeterView', git: 'https://github.com/andreamazz/DPMeterView'
pod 'BAFluidView', git: 'https://github.com/andreamazz/BAFluidView', branch: 'fix-background-glitch'
pod 'BubbleTransition'
# pod 'BEMSimpleLineGraph'
end
Expand All @@ -21,7 +21,7 @@ end
target 'GulpsTests' do
common_pods
pod 'Nimble'
pod 'Quick'
pod 'Quick', '~> 0.3.1'
pod 'Nimble-Snapshots'
end

Expand Down
2 changes: 1 addition & 1 deletion Realm.framework/Headers/RLMRealm.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
/**
Returns the location of the default Realm as a string.
`~/Application Support/{bundle ID}/default.realm` on OS X.
`~/Library/Application Support/{bundle ID}/default.realm` on OS X.
`default.realm` in your application's documents directory on iOS.
Expand Down
Binary file modified Realm.framework/Info.plist
Binary file not shown.
19 changes: 9 additions & 10 deletions Realm.framework/PrivateHeaders/RLMObjectStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
extern "C" {
#endif

@class RLMRealm, RLMSchema, RLMObjectSchema, RLMObjectBase, RLMResults;
@class RLMRealm, RLMSchema, RLMObjectSchema, RLMObjectBase, RLMResults, RLMProperty;

//
// Table modifications
Expand All @@ -49,21 +49,19 @@ void RLMRealmCreateAccessors(RLMSchema *schema);
// Clear the cache of created accessor classes
void RLMClearAccessorCache();


//
// Options for object creation
//
typedef NS_OPTIONS(NSUInteger, RLMCreationOptions) {
// Normal object creation
RLMCreationOptionsNone = 0,
// Verify that no existing row has the same value for this property
RLMCreationOptionsEnforceUnique = 1 << 0,
// If the property is a link or array property, upsert the linked objects
// if they have a primary key, and insert them otherwise.
RLMCreationOptionsUpdateOrCreate = 1 << 1,
// If a link or array property links to an object persisted in a different
// realm from the object, copy it into the object's realm rather than throwing
// an error
RLMCreationOptionsAllowCopy = 1 << 2,
RLMCreationOptionsCreateOrUpdate = 1 << 0,
// Allow standalone objects to be promoted to persisted objects
// if false objects are copied during object creation
RLMCreationOptionsPromoteStandalone = 1 << 1,
};


Expand All @@ -72,7 +70,7 @@ typedef NS_OPTIONS(NSUInteger, RLMCreationOptions) {
//

// add an object to the given realm
void RLMAddObjectToRealm(RLMObjectBase *object, RLMRealm *realm, RLMCreationOptions options);
void RLMAddObjectToRealm(RLMObjectBase *object, RLMRealm *realm, bool createOrUpdate);

// delete an object from its realm
void RLMDeleteObjectFromRealm(RLMObjectBase *object, RLMRealm *realm);
Expand All @@ -87,7 +85,8 @@ RLMResults *RLMGetObjects(RLMRealm *realm, NSString *objectClassName, NSPredicat
id RLMGetObject(RLMRealm *realm, NSString *objectClassName, id key) NS_RETURNS_RETAINED;

// create object from array or dictionary
RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className, id value, RLMCreationOptions options) NS_RETURNS_RETAINED;
RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className, id value, bool createOrUpdate) NS_RETURNS_RETAINED;


//
// Accessor Creation
Expand Down
1 change: 0 additions & 1 deletion Realm.framework/PrivateHeaders/RLMObject_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
@class RLMProperty, RLMArray;
@interface RLMObjectUtil : NSObject

+ (NSString *)primaryKeyForClass:(Class)cls;
+ (NSArray *)ignoredPropertiesForClass:(Class)cls;
+ (NSArray *)indexedPropertiesForClass:(Class)cls;

Expand Down
Binary file modified Realm.framework/Realm
Binary file not shown.
14 changes: 7 additions & 7 deletions Realm.framework/_CodeSignature/CodeResources
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</data>
<key>Headers/RLMRealm.h</key>
<data>
KMZtzfK3rzOY3PbG0CGVpxbgLBU=
4+l3V24DC08f9vm/e9UUmx5iC9M=
</data>
<key>Headers/RLMResults.h</key>
<data>
Expand All @@ -58,7 +58,7 @@
</data>
<key>Info.plist</key>
<data>
H5pZK9SGTa+Zj4LGZSC5ysXiW9I=
YRCoaiwZhJDk9TCFqEECpZUQ9E8=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand All @@ -82,11 +82,11 @@
</data>
<key>PrivateHeaders/RLMObjectStore.h</key>
<data>
SieIilk3RA7AYCSVwMjZQJL4N1s=
2eu5sXUOw9WNm6bMjBn/WeosaJg=
</data>
<key>PrivateHeaders/RLMObject_Private.h</key>
<data>
auBEsEf+I05lawC78X6AOaSk1vM=
4y+iJiwWybc2MhVNP/lRdpN9mD4=
</data>
<key>PrivateHeaders/RLMProperty_Private.h</key>
<data>
Expand Down Expand Up @@ -157,7 +157,7 @@
</data>
<key>Headers/RLMRealm.h</key>
<data>
KMZtzfK3rzOY3PbG0CGVpxbgLBU=
4+l3V24DC08f9vm/e9UUmx5iC9M=
</data>
<key>Headers/RLMResults.h</key>
<data>
Expand Down Expand Up @@ -193,11 +193,11 @@
</data>
<key>PrivateHeaders/RLMObjectStore.h</key>
<data>
SieIilk3RA7AYCSVwMjZQJL4N1s=
2eu5sXUOw9WNm6bMjBn/WeosaJg=
</data>
<key>PrivateHeaders/RLMObject_Private.h</key>
<data>
auBEsEf+I05lawC78X6AOaSk1vM=
4y+iJiwWybc2MhVNP/lRdpN9mD4=
</data>
<key>PrivateHeaders/RLMProperty_Private.h</key>
<data>
Expand Down
Binary file modified RealmSwift.framework/Info.plist
Binary file not shown.
Binary file modified RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified RealmSwift.framework/RealmSwift
Binary file not shown.
18 changes: 9 additions & 9 deletions RealmSwift.framework/_CodeSignature/CodeResources
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
</data>
<key>Info.plist</key>
<data>
kkawxZyNUg9KvOUXDxm18RtUruo=
cUcPfQgNFvcYn6VI4HZWULShkBE=
</data>
<key>Modules/RealmSwift.swiftmodule/arm.swiftdoc</key>
<data>
LDcjN3o53Yniqu/dc3DE1UMrnGk=
QUu12ZXWL3s9itSk/viGwBb583A=
</data>
<key>Modules/RealmSwift.swiftmodule/arm.swiftmodule</key>
<data>
8UhVIcOJLb8umkjAmEtOY20dwAM=
o285FtIezRZuPNt7ulldtQZ0dus=
</data>
<key>Modules/RealmSwift.swiftmodule/arm64.swiftdoc</key>
<data>
2n6s6JaFxAEe0BILy60a7+aEZ18=
ZTosiPDsxBluyWJzyguXCYrHX5Y=
</data>
<key>Modules/RealmSwift.swiftmodule/arm64.swiftmodule</key>
<data>
N9DZrtiv5FB4U6yqkkuCqv6xYcs=
f+JeQSI/TP3ivI/8mK+2jXsV6sc=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand All @@ -41,19 +41,19 @@
</data>
<key>Modules/RealmSwift.swiftmodule/arm.swiftdoc</key>
<data>
LDcjN3o53Yniqu/dc3DE1UMrnGk=
QUu12ZXWL3s9itSk/viGwBb583A=
</data>
<key>Modules/RealmSwift.swiftmodule/arm.swiftmodule</key>
<data>
8UhVIcOJLb8umkjAmEtOY20dwAM=
o285FtIezRZuPNt7ulldtQZ0dus=
</data>
<key>Modules/RealmSwift.swiftmodule/arm64.swiftdoc</key>
<data>
2n6s6JaFxAEe0BILy60a7+aEZ18=
ZTosiPDsxBluyWJzyguXCYrHX5Y=
</data>
<key>Modules/RealmSwift.swiftmodule/arm64.swiftmodule</key>
<data>
N9DZrtiv5FB4U6yqkkuCqv6xYcs=
f+JeQSI/TP3ivI/8mK+2jXsV6sc=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand Down
Binary file modified assets/gulps.sketch
Binary file not shown.

0 comments on commit 86b1fbe

Please sign in to comment.