Skip to content

Commit 9b049a0

Browse files
committed
Initial Commit
0 parents  commit 9b049a0

File tree

12 files changed

+770
-0
lines changed

12 files changed

+770
-0
lines changed

iOSSwiftOpenGL.xcodeproj/project.pbxproj

+429
Large diffs are not rendered by default.

iOSSwiftOpenGL.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iOSSwiftOpenGL/AppDelegate.swift

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
//
2+
// AppDelegate.swift
3+
// iOSSwiftOpenGL
4+
//
5+
// Created by Bradley Griffith on 6/29/14.
6+
// Copyright (c) 2014 Bradley Griffith. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import CoreData
11+
12+
@UIApplicationMain
13+
class AppDelegate: UIResponder, UIApplicationDelegate {
14+
15+
var window: UIWindow?
16+
17+
18+
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
19+
// Override point for customization after application launch.
20+
return true
21+
}
22+
23+
func applicationWillResignActive(application: UIApplication) {
24+
// 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.
25+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26+
}
27+
28+
func applicationDidEnterBackground(application: UIApplication) {
29+
// 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.
30+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31+
}
32+
33+
func applicationWillEnterForeground(application: UIApplication) {
34+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35+
}
36+
37+
func applicationDidBecomeActive(application: UIApplication) {
38+
// 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.
39+
}
40+
41+
func applicationWillTerminate(application: UIApplication) {
42+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43+
// Saves changes in the application's managed object context before the application terminates.
44+
self.saveContext()
45+
}
46+
47+
func saveContext () {
48+
var error: NSError? = nil
49+
let managedObjectContext = self.managedObjectContext
50+
if managedObjectContext != nil {
51+
if managedObjectContext.hasChanges && !managedObjectContext.save(&error) {
52+
// Replace this implementation with code to handle the error appropriately.
53+
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
54+
//println("Unresolved error \(error), \(error.userInfo)")
55+
abort()
56+
}
57+
}
58+
}
59+
60+
// #pragma mark - Core Data stack
61+
62+
// Returns the managed object context for the application.
63+
// If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
64+
var managedObjectContext: NSManagedObjectContext {
65+
if !_managedObjectContext {
66+
let coordinator = self.persistentStoreCoordinator
67+
if coordinator != nil {
68+
_managedObjectContext = NSManagedObjectContext()
69+
_managedObjectContext!.persistentStoreCoordinator = coordinator
70+
}
71+
}
72+
return _managedObjectContext!
73+
}
74+
var _managedObjectContext: NSManagedObjectContext? = nil
75+
76+
// Returns the managed object model for the application.
77+
// If the model doesn't already exist, it is created from the application's model.
78+
var managedObjectModel: NSManagedObjectModel {
79+
if !_managedObjectModel {
80+
let modelURL = NSBundle.mainBundle().URLForResource("iOSSwiftOpenGL", withExtension: "momd")
81+
_managedObjectModel = NSManagedObjectModel(contentsOfURL: modelURL)
82+
}
83+
return _managedObjectModel!
84+
}
85+
var _managedObjectModel: NSManagedObjectModel? = nil
86+
87+
// Returns the persistent store coordinator for the application.
88+
// If the coordinator doesn't already exist, it is created and the application's store added to it.
89+
var persistentStoreCoordinator: NSPersistentStoreCoordinator {
90+
if !_persistentStoreCoordinator {
91+
let storeURL = self.applicationDocumentsDirectory.URLByAppendingPathComponent("iOSSwiftOpenGL.sqlite")
92+
var error: NSError? = nil
93+
_persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
94+
if _persistentStoreCoordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: storeURL, options: nil, error: &error) == nil {
95+
/*
96+
Replace this implementation with code to handle the error appropriately.
97+
98+
abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
99+
100+
Typical reasons for an error here include:
101+
* The persistent store is not accessible;
102+
* The schema for the persistent store is incompatible with current managed object model.
103+
Check the error message to determine what the actual problem was.
104+
105+
106+
If the persistent store is not accessible, there is typically something wrong with the file path. Often, a file URL is pointing into the application's resources directory instead of a writeable directory.
107+
108+
If you encounter schema incompatibility errors during development, you can reduce their frequency by:
109+
* Simply deleting the existing store:
110+
NSFileManager.defaultManager().removeItemAtURL(storeURL, error: nil)
111+
112+
* Performing automatic lightweight migration by passing the following dictionary as the options parameter:
113+
[NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true}
114+
115+
Lightweight migration will only work for a limited set of schema changes; consult "Core Data Model Versioning and Data Migration Programming Guide" for details.
116+
117+
*/
118+
//println("Unresolved error \(error), \(error.userInfo)")
119+
abort()
120+
}
121+
}
122+
return _persistentStoreCoordinator!
123+
}
124+
var _persistentStoreCoordinator: NSPersistentStoreCoordinator? = nil
125+
126+
// #pragma mark - Application's Documents directory
127+
128+
// Returns the URL to the application's Documents directory.
129+
var applicationDocumentsDirectory: NSURL {
130+
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
131+
return urls[urls.endIndex-1] as NSURL
132+
}
133+
134+
}
135+
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6162" systemVersion="14A238h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6160"/>
5+
</dependencies>
6+
<scenes>
7+
<!--View Controller-->
8+
<scene sceneID="ufC-wZ-h7g">
9+
<objects>
10+
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
11+
<layoutGuides>
12+
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
13+
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
14+
</layoutGuides>
15+
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
16+
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
17+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
18+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
19+
</view>
20+
</viewController>
21+
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
22+
</objects>
23+
</scene>
24+
</scenes>
25+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "40x40",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "60x60",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"orientation" : "portrait",
5+
"idiom" : "iphone",
6+
"extent" : "full-screen",
7+
"minimum-system-version" : "7.0",
8+
"scale" : "2x"
9+
},
10+
{
11+
"orientation" : "portrait",
12+
"idiom" : "iphone",
13+
"subtype" : "retina4",
14+
"extent" : "full-screen",
15+
"minimum-system-version" : "7.0",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}

iOSSwiftOpenGL/Info.plist

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>Bradley-Griffith.${PRODUCT_NAME:rfc1034identifier}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>LSRequiresIPhoneOS</key>
24+
<true/>
25+
<key>UIMainStoryboardFile</key>
26+
<string>Main</string>
27+
<key>UIRequiredDeviceCapabilities</key>
28+
<array>
29+
<string>armv7</string>
30+
</array>
31+
</dict>
32+
</plist>

iOSSwiftOpenGL/ViewController.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// ViewController.swift
3+
// iOSSwiftOpenGL
4+
//
5+
// Created by Bradley Griffith on 6/29/14.
6+
// Copyright (c) 2014 Bradley Griffith. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class ViewController: UIViewController {
12+
13+
override func viewDidLoad() {
14+
super.viewDidLoad()
15+
// Do any additional setup after loading the view, typically from a nib.
16+
}
17+
18+
override func didReceiveMemoryWarning() {
19+
super.didReceiveMemoryWarning()
20+
// Dispose of any resources that can be recreated.
21+
}
22+
23+
24+
}
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>_XCCurrentVersionName</key>
6+
<string>iOSSwiftOpenGL.xcdatamodel</string>
7+
</dict>
8+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<model name="Test1.xcdatamodel" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
3+
<elements/>
4+
</model>

iOSSwiftOpenGLTests/Info.plist

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>Bradley-Griffith.${PRODUCT_NAME:rfc1034identifier}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>${PRODUCT_NAME}</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
</dict>
24+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// iOSSwiftOpenGLTests.swift
3+
// iOSSwiftOpenGLTests
4+
//
5+
// Created by Bradley Griffith on 6/29/14.
6+
// Copyright (c) 2014 Bradley Griffith. All rights reserved.
7+
//
8+
9+
import XCTest
10+
11+
class iOSSwiftOpenGLTests: XCTestCase {
12+
13+
override func setUp() {
14+
super.setUp()
15+
// Put setup code here. This method is called before the invocation of each test method in the class.
16+
}
17+
18+
override func tearDown() {
19+
// Put teardown code here. This method is called after the invocation of each test method in the class.
20+
super.tearDown()
21+
}
22+
23+
func testExample() {
24+
// This is an example of a functional test case.
25+
XCTAssert(true, "Pass")
26+
}
27+
28+
func testPerformanceExample() {
29+
// This is an example of a performance test case.
30+
self.measureBlock() {
31+
// Put the code you want to measure the time of here.
32+
}
33+
}
34+
35+
}

0 commit comments

Comments
 (0)