Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
6ECE0CD91AB87C8600C054DD /* AirbnbSessionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ECE0CD71AB87C8600C054DD /* AirbnbSessionView.swift */; };
6ECE0CDA1AB87C8600C054DD /* AirbnbViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ECE0CD81AB87C8600C054DD /* AirbnbViewController.swift */; };
6ECE0CE01AB87F1C00C054DD /* AirbnbHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECE0CDE1AB87F1C00C054DD /* AirbnbHelper.m */; };
6ED29F9D1A77BA85005675F8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED29F9C1A77BA85005675F8 /* AppDelegate.swift */; };
6ED29F9F1A77BA85005675F8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED29F9E1A77BA85005675F8 /* ViewController.swift */; };
6ED29FA41A77BA85005675F8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6ED29FA31A77BA85005675F8 /* Images.xcassets */; };
Expand All @@ -31,8 +30,6 @@
/* Begin PBXFileReference section */
6ECE0CD71AB87C8600C054DD /* AirbnbSessionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AirbnbSessionView.swift; path = ../../AirbnbViewController/AirbnbSessionView.swift; sourceTree = "<group>"; };
6ECE0CD81AB87C8600C054DD /* AirbnbViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AirbnbViewController.swift; path = ../../AirbnbViewController/AirbnbViewController.swift; sourceTree = "<group>"; };
6ECE0CDD1AB87F1C00C054DD /* AirbnbHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AirbnbHelper.h; path = ../../AirbnbViewController/AirbnbHelper.h; sourceTree = "<group>"; };
6ECE0CDE1AB87F1C00C054DD /* AirbnbHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AirbnbHelper.m; path = ../../AirbnbViewController/AirbnbHelper.m; sourceTree = "<group>"; };
6ED29F971A77BA85005675F8 /* AirbnbViewController-Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AirbnbViewController-Sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
6ED29F9B1A77BA85005675F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6ED29F9C1A77BA85005675F8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -42,7 +39,6 @@
6ED29FAC1A77BA85005675F8 /* AirbnbViewController-SampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AirbnbViewController-SampleTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
6ED29FB11A77BA85005675F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6ED29FB21A77BA85005675F8 /* AirbnbViewController_SampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirbnbViewController_SampleTests.swift; sourceTree = "<group>"; };
6ED29FC51A77C0F7005675F8 /* AirbnbViewController-Sample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AirbnbViewController-Sample-Bridging-Header.h"; sourceTree = "<group>"; };
6ED29FC61A77C1FA005675F8 /* MenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -67,8 +63,6 @@
6ECE0CDB1AB87C8E00C054DD /* AirbnbViewController */ = {
isa = PBXGroup;
children = (
6ECE0CDD1AB87F1C00C054DD /* AirbnbHelper.h */,
6ECE0CDE1AB87F1C00C054DD /* AirbnbHelper.m */,
6ECE0CD71AB87C8600C054DD /* AirbnbSessionView.swift */,
6ECE0CD81AB87C8600C054DD /* AirbnbViewController.swift */,
);
Expand Down Expand Up @@ -111,7 +105,6 @@
isa = PBXGroup;
children = (
6ED29F9B1A77BA85005675F8 /* Info.plist */,
6ED29FC51A77C0F7005675F8 /* AirbnbViewController-Sample-Bridging-Header.h */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -177,14 +170,16 @@
6ED29F8F1A77BA85005675F8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = pixyzehn;
TargetAttributes = {
6ED29F961A77BA85005675F8 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0900;
};
6ED29FAB1A77BA85005675F8 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0900;
TestTargetID = 6ED29F961A77BA85005675F8;
};
};
Expand Down Expand Up @@ -232,7 +227,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6ECE0CE01AB87F1C00C054DD /* AirbnbHelper.m in Sources */,
6ECE0CD91AB87C8600C054DD /* AirbnbSessionView.swift in Sources */,
6ECE0CDA1AB87C8600C054DD /* AirbnbViewController.swift in Sources */,
6ED29F9F1A77BA85005675F8 /* ViewController.swift in Sources */,
Expand Down Expand Up @@ -279,20 +273,30 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -309,7 +313,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PROJECT)/AirbnbViewController-Sample-Bridging-Header.h";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
Expand All @@ -322,20 +326,29 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -345,7 +358,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/$(PROJECT)/AirbnbViewController-Sample-Bridging-Header.h";
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -357,7 +371,10 @@
INFOPLIST_FILE = "AirbnbViewController-Sample/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "pixyzehn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -368,7 +385,10 @@
INFOPLIST_FILE = "AirbnbViewController-Sample/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "pixyzehn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -386,7 +406,10 @@
);
INFOPLIST_FILE = "AirbnbViewController-SampleTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "pixyzehn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AirbnbViewController-Sample.app/AirbnbViewController-Sample";
};
name = Debug;
Expand All @@ -401,7 +424,10 @@
);
INFOPLIST_FILE = "AirbnbViewController-SampleTests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "pixyzehn.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/AirbnbViewController-Sample.app/AirbnbViewController-Sample";
};
name = Release;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,42 +13,42 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window = UIWindow(frame: UIScreen.main.bounds)

let viewController: ViewController = ViewController()
let controller: UINavigationController = UINavigationController(rootViewController: viewController)
viewController.view.backgroundColor = UIColor(red:0, green:0.23, blue:0.36, alpha:1)

let menuController: MenuViewController = MenuViewController(viewController: controller, atIndexPath: NSIndexPath(forRow: 0, inSection: 0))
let menuController: MenuViewController = MenuViewController(viewController: controller, atIndexPath: IndexPath(row: 0, section: 0))

self.window!.rootViewController = menuController
self.window!.makeKeyAndVisible()

return true
}

func applicationWillResignActive(application: UIApplication) {
func applicationWillResignActive(_ application: UIApplication) {
// 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
func applicationDidEnterBackground(_ application: UIApplication) {
// 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.
}

func applicationWillEnterForeground(application: UIApplication) {
func applicationWillEnterForeground(_ application: UIApplication) {
// 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.
}

func applicationDidBecomeActive(application: UIApplication) {
func applicationDidBecomeActive(_ application: UIApplication) {
// 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.
}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>pixyzehn.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

import UIKit

class MenuViewController: AirbnbViewController, AirbnbMenuDelegate, AirbnbMenuDataSource {
class MenuViewController: AirbnbViewController {

override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor.whiteColor()
self.view.backgroundColor = UIColor.white
}

//MARK: AirbnbMenuDataSource
Expand All @@ -21,19 +21,23 @@ class MenuViewController: AirbnbViewController, AirbnbMenuDelegate, AirbnbMenuDa
return 10
}

override func numberOfRowsInSession(session: Int) -> Int {
override func numberOfRowsInSession(_ session: Int) -> Int {
return 3
}

override func titleForRowAtIndexPath(indexPath: NSIndexPath) -> String {
override func titleForRowAtIndexPath(_ indexPath: IndexPath) -> String {
return "Row \(indexPath.row) in \(indexPath.section)"
}

override func titleForHeaderAtSession(session: Int) -> String {
override func titleForHeaderAtSession(_ session: Int) -> String {
return "Session \(session)"
}

func viewControllerForIndexPath(indexPath: NSIndexPath) -> UIViewController {
func imageForRowAtIndexPath(_ indexPath: IndexPath) -> UIImage {
return drawRandomCircle()
}

func viewControllerForIndexPath(_ indexPath: IndexPath) -> UIViewController {
let viewController: ViewController = ViewController()

let controller: UINavigationController = UINavigationController(rootViewController: viewController)
Expand All @@ -53,11 +57,11 @@ class MenuViewController: AirbnbViewController, AirbnbMenuDelegate, AirbnbMenuDa

//MARK: AirbnbMenuDelegate

func didSelectRowAtIndex(indexPath: NSIndexPath) {
func didSelectRowAtIndex(_ indexPath: IndexPath) {
print("didSelectRowAtIndex:\(indexPath.row)\n")
}

func shouldSelectRowAtIndex(indexPath: NSIndexPath) -> Bool {
func shouldSelectRowAtIndex(_ indexPath: IndexPath) -> Bool {
return true
}

Expand All @@ -77,7 +81,46 @@ class MenuViewController: AirbnbViewController, AirbnbMenuDelegate, AirbnbMenuDa
return 90.0
}

func indexPathDefaultValue() -> NSIndexPath? {
return NSIndexPath(index: 2)
func indexPathDefaultValue() -> IndexPath? {
return IndexPath(index: 2)
}

//MARK: Utilities

func drawRandomCircle() -> UIImage {
let scale = UIScreen.main.scale
let frame = CGRect(origin: .zero, size: CGSize(width: 30, height: 30))
UIGraphicsBeginImageContextWithOptions(frame.size, false, scale)
let context = UIGraphicsGetCurrentContext()

guard context != nil else {
return UIImage()
}

let circlePath = CGPath(ellipseIn: frame, transform: nil)
context!.addPath(circlePath)
context!.clip()

let bgColor = generateRandomColor().cgColor
context!.setFillColor(bgColor)
context!.fill(frame)

let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()

if let image = image {
return image
}
else {
return UIImage()
}
}

func generateRandomColor() -> UIColor {
let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0
let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white
let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black

return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1)
}
}
Loading