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
- (void)postJSONToSlack { | |
// This is the URL to your Slack team and channel | |
NSMutableURLRequest *request = [NSMutableURLRequest | |
requestWithURL:[NSURL URLWithString:@"https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_ID_HERE"]]; | |
NSDictionary *requestData = [[NSDictionary alloc] initWithObjectsAndKeys: | |
@"Test post to NMDevs from iOS.\nSlack Webhook integration.", @"text", | |
nil]; | |
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
// | |
// ViewController.swift | |
// HelloToDoSwift | |
// | |
// Created by Chris Jungmann on 4/1/16. | |
// Copyright © 2016 Chris Jungmann. All rights reserved. | |
// | |
import UIKit |
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
func initWithCoder(aDecoder:NSCoder ) -> instancetype { | |
self = super.init() | |
self.seatUUID = aDecoder.decodeObjectForKey("seatUUID") | |
self.seatManuID1 = aDecoder.decodeObjectForKey("seatManuID1") | |
self.seatManuID2 = aDecoder.decodeObjectForKey("seatManuID2") | |
self.seatDataStructure = aDecoder.decodeObjectForKey("seatDataStructure") | |
self.seatBabyPresent = aDecoder.decodeObjectForKey("seatBabyPresent") | |
self.seatBatteryLevel = aDecoder.decodeObjectForKey("seatBatteryLevel") | |
self.seatSignalStrength = aDecoder.decodeObjectForKey("seatSignalStrength") |
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
// | |
// AddStuffVC.swift | |
// HelloToDoSwift | |
// | |
// Created by Chris Jungmann on 4/1/16. | |
// Copyright © 2016 Chris Jungmann. All rights reserved. | |
// | |
import UIKit |
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
// | |
// ItemModel.swift | |
// HelloToDoSwift | |
// | |
// Created by Chris Jungmann on 4/2/16. | |
// Copyright © 2016 Chris Jungmann. All rights reserved. | |
// | |
// http://nshipster.com/nscoding/ | |
import UIKit |
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
// Chris Jungmann Metal Experimentation | |
// Based on Ray Wenderlich's tutorial | |
// http://www.raywenderlich.com/77488/ios-8-metal-tutorial-swift-getting-started | |
// | |
import UIKit | |
import Metal | |
import QuartzCore // had to set to Generic iOS Device for this to import properly | |
// http://www.raywenderlich.com/forums/viewtopic.php?f=20&t=18159&start=40 |
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
// Method to calc a four sided polyhedron | |
- (void)createTetrahedron { | |
// constants & vars based on four faces (triangles) | |
int trianglesAroundZ = 3; // arbitrary choice of z axis | |
float seedPointAngle = 90.0; // first point P1 vertex angle from x-y plane | |
float distanceToOrigin = 1.0; | |
float angleBetweenPoints = 360/trianglesAroundZ; | |
// determine cone aspects |
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
///////////////////////////////////////////////////////////////// | |
// Declare data types | |
// This data type is used to store information for each vertex | |
typedef struct { | |
GLKVector3 positionCoords; | |
} | |
SceneVertex; | |
///////////////////////////////////////////////////////////////// | |
// Define vertex data for a triangle to use in example |
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
// save array data | |
- (void)saveArrayData { | |
NSMutableDictionary *dataDict = [[NSMutableDictionary alloc] initWithCapacity:365]; | |
if (urgeArray != nil) { | |
[dataDict setObject:urgeArray forKey:@"events"]; // save the urges array | |
} | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectoryPath = [paths objectAtIndex:0]; |
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
- (void)viewWillDisappear:(BOOL)animated { | |
[super viewWillDisappear:animated]; | |
// check if exiting | |
if (self.isMovingFromParentViewController) { | |
NSLog(@"isMovingFromParentViewController"); | |
// set public property to indicate this view will not longer be presented | |
self.isPresented = NO; | |
// forces a return to portrait orientation | |
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait]; | |
[[UIDevice currentDevice] setValue:value forKey:@"orientation"]; |