Skip to content

Contacts MRC App #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d6074bf
Set up Custom Control
lmsampson Aug 28, 2018
1213a4e
Add touch handlers
lmsampson Aug 28, 2018
d9528b0
Add touch response
lmsampson Aug 28, 2018
3c1a725
Bug fixes
lmsampson Aug 28, 2018
20b7a60
Add 4 and 6 star functionality and additional flare animations
lmsampson Aug 29, 2018
1be6f87
Merge remote-tracking branch 'upstream/master'
lmsampson Aug 29, 2018
f022c83
Set up UI for animimation
lmsampson Aug 29, 2018
8e37544
Hook up scatter and gather
lmsampson Aug 29, 2018
0a351ba
Cleanup
lmsampson Aug 30, 2018
635b694
Update
lmsampson Aug 30, 2018
25a6d11
Set up skeleton app
lmsampson Aug 30, 2018
77648c6
Implement animation scaffolding
lmsampson Aug 30, 2018
f9648e9
Implement animations
lmsampson Aug 31, 2018
b70b821
Merge remote-tracking branch 'upstream/master'
lmsampson Sep 4, 2018
f54b7f7
work with generics in playground
lmsampson Sep 4, 2018
c3d9c42
merge
lmsampson Sep 5, 2018
f5e4404
base of project complete with temporary solution for deadlock
lmsampson Sep 5, 2018
7d9ef26
add index to spoons to prevent deadlock
lmsampson Sep 5, 2018
6636f94
testing
lmsampson Sep 5, 2018
e182463
Merge remote-tracking branch 'upstream/master'
lmsampson Sep 19, 2018
0b552f4
create simple app that uses framework to create a loading screen for app
lmsampson Sep 19, 2018
b230d2a
update
lmsampson Sep 19, 2018
30230f4
Minor tweaks
lmsampson Feb 14, 2019
5209638
minor tweaks
lmsampson Feb 14, 2019
6eea075
minor tweaks
lmsampson Feb 14, 2019
be26969
Merge with master
lmsampson Feb 28, 2019
dce9a6f
Initial commit
lmsampson Feb 28, 2019
3e6a38d
Set up all files
lmsampson Feb 28, 2019
deab997
Set up stack
lmsampson Feb 28, 2019
54e73b6
Set up calculator functions
lmsampson Feb 28, 2019
21ea79c
Set up digit accumulator
lmsampson Feb 28, 2019
0943052
Hook view controller up
lmsampson Mar 1, 2019
96d1a66
Initial commit
lmsampson Mar 4, 2019
77c3a31
Initial commit
lmsampson Mar 6, 2019
2564b12
Create storyboards and begin implementation of basic logic
lmsampson Mar 6, 2019
fb62ce3
Update with functioning create and bug in update
lmsampson Mar 6, 2019
7d4a4b5
complete working project w/out memory management
lmsampson Mar 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// LMSCalculator.h
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface LMSCalculator : NSObject

typedef NS_ENUM(NSInteger, LMSCalculatorOperator) {
LMSCalculatorOperatorAdd,
LMSCalculatorOperatorSubtract,
LMSCalculatorOperatorMultiply,
LMSCalculatorOperatorDivide
};

@property (readonly) double topValue;

- (void)pushNumber:(double)value;
- (void)applyCalculatorOperator:(LMSCalculatorOperator)calculatorOperator;
- (void)clear;
@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// LMSCalculator.m
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import "LMSCalculator.h"
#import "LMSStack.h"

@interface LMSCalculator ()

@property LMSStack *stack;

@end

@implementation LMSCalculator

- (instancetype)init
{
self = [super init];
if (self != nil) {
_stack = [[LMSStack alloc] initWithArray:@[@0.0, @0.0]];
}
return self;
}

- (double)topValue {
return [[self.stack peek] doubleValue];
}

- (void)pushNumber:(double)value {
NSNumber *number = [NSNumber numberWithDouble:value];
[self.stack push:number];
}
- (void)applyCalculatorOperator:(LMSCalculatorOperator)calculatorOperator {

double operand2 = [[self.stack pop] doubleValue];
double operand1 = [[self.stack pop] doubleValue];

double result = 0.0;
switch (calculatorOperator) {
case LMSCalculatorOperatorAdd:
result = operand1 + operand2;
break;
case LMSCalculatorOperatorSubtract:
result = operand1 - operand2;
break;
case LMSCalculatorOperatorMultiply:
result = operand1 * operand2;
break;
case LMSCalculatorOperatorDivide:
result = operand1 / operand2;
break;
}
[self.stack push:[NSNumber numberWithDouble:result]];
}
- (void)clear {
self.stack = [[LMSStack alloc] initWithArray:@[@0.0, @0.0]];
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// LMSDigitAccumulator.h
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface LMSDigitAccumulator : NSObject

@property (readonly) double value;

- (void)addDigitWithNumericValue: (NSInteger)number;
- (void)addDecimalPoint;
- (void)clear;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// LMSDigitAccumulator.m
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import "LMSDigitAccumulator.h"

@interface LMSDigitAccumulator ()

@property NSMutableArray *digits;

@end

@implementation LMSDigitAccumulator

- (instancetype)init {
self = [super init];
if (self != nil) {
_digits = [NSMutableArray arrayWithArray:@[]];
}
return self;
}

- (double)value {
NSString *numberAsString = [self.digits componentsJoinedByString:@""];
double number = numberAsString.doubleValue;
return number;
}

- (void)addDigitWithNumericValue: (NSInteger)number {
NSNumber *digit = [NSNumber numberWithInteger:number];
NSString *string = digit.stringValue;
[self.digits addObject:string];
}

- (void)addDecimalPoint {
[self.digits addObject:@"."];
}

- (void)clear {
[self.digits removeAllObjects];
}

@end
23 changes: 23 additions & 0 deletions Sprint 11/Module 4/RPNCalculatorObjC/RPNCalculatorObjC/LMSStack.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// LMSStack.h
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface LMSStack : NSObject

- (instancetype)initWithArray: (NSArray *)array;

- (void)push: (NSNumber *)value;
- (NSNumber *)pop;
- (NSNumber *)peek;

@end

NS_ASSUME_NONNULL_END
41 changes: 41 additions & 0 deletions Sprint 11/Module 4/RPNCalculatorObjC/RPNCalculatorObjC/LMSStack.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// LMSStack.m
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import "LMSStack.h"

@interface LMSStack ()

@property NSMutableArray *values;

@end

@implementation LMSStack

- (instancetype)initWithArray:(NSArray *)array {
self = [super init];
if (self != nil) {
_values = array.mutableCopy;
}
return self;
}

- (void)push:(NSNumber *)value {
[self.values addObject:value];
}

- (NSNumber *)pop {
NSNumber *last = self.values.lastObject;
[self.values removeLastObject];
return last;
}

- (NSNumber *)peek {
return self.values.lastObject;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// AppDelegate.m
// RPNCalculatorObjC
//
// Created by Lisa Sampson on 2/28/19.
// Copyright © 2019 Lisa M Sampson. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
Loading