Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #36 from brockboland/swift3
Swift 3 support
  • Loading branch information
brockboland committed Nov 14, 2016
2 parents 8dc941b + 4295590 commit 7d1a4ab
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 176 deletions.
188 changes: 39 additions & 149 deletions .gitignore
@@ -1,172 +1,62 @@
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
# Xcode
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.1
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
# - added line-by-line explanations for EVERYTHING (some were missing)
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
#########################

#####
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.DS_Store

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.Trashes

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

*.swp

# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV

*.lock

# ... but don't ignore the Podfile.lock or the Pods/Manifest.lock file
!Podfile.lock
!Pods/Manifest.lock

#
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
#profile


####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...

*~.nib


####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"

DerivedData/

# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/


#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"

# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html

## Various settings
*.pbxuser

# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode1v3

# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode2v3

# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file

*.perspectivev3

# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

####
# Xcode 4 - semi-personal settings
#
#
# OPTION 1: ---------------------------------
# throw away ALL personal settings (including custom schemes!
# - unless they are "shared")
#
# NB: this is exclusive with OPTION 2 below
xcuserdata
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

# OPTION 2: ---------------------------------
# get rid of ALL personal settings, but KEEP SOME OF THEM
# - NB: you must manually uncomment the bits you want to keep
# CocoaPods
#
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
# or manually install git over the top of the OS X version
# NB: this is exclusive with OPTION 1 above
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
#xcuserdata/**/*
# Pods/

# (requires option 2 above): Personal Schemes
# Carthage
#
#!xcuserdata/**/xcschemes/*
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# /(root)/
# /(project-name).xcodeproj/
# project.pbxproj
# /project.xcworkspace/
# contents.xcworkspacedata
# /xcuserdata/
# /(your name)/xcuserdatad/
# UserInterfaceState.xcuserstate
# /xcsshareddata/
# /xcschemes/
# (shared scheme name).xcscheme
# /xcuserdata/
# /(your name)/xcuserdatad/
# (private scheme).xcscheme
# xcschememanagement.plist
#
#
Carthage/Build

####
# Xcode 4 - Deprecated classes
# fastlane
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

*.moved-aside
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

####
# UNKNOWN: recommended by others, but I can't discover what these files are
# Code Injection
#
# ...none. Everything is now explained.

# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

# Also, ignore .xccheckout files, as they contain data about specific paths and remotes that doesn't feel right in the repo. -igreensp 20131230
*.xccheckout
iOSInjectionProject/
36 changes: 16 additions & 20 deletions .travis.yml
@@ -1,27 +1,23 @@
language: objective-c
osx_image: xcode7
before_install:
- brew update >/dev/null
- if brew outdated | grep -qx xctool; then brew upgrade xctool; fi
osx_image: xcode8
before_script:
- xctool -configuration Release -workspace Cat2Cat.xcworkspace -scheme Cat2Cat -sdk macosx10.11 CONFIGURATION_BUILD_DIR='~/build/'
# Build the Cat2Cat binary for use in the test projects
- xcodebuild -configuration Release -workspace Cat2Cat.xcworkspace -scheme Cat2Cat -sdk macosx CONFIGURATION_BUILD_DIR='~/build/'
- cp ~/build/Cat2Cat CocoaPod/
- rm SampleiOSApp/Cat2CatExample/Cat2CatExample/Categories/UIImage+AssetCatalog.?
- rm SampleMacApp/Cat2CatExampleMac/Cat2CatExampleMac/Categories/NSImage+AssetCatalog.?
- rm SampleSwiftiOSApp/Cat2CatExampleSwift/Cat2CatExampleSwift/Cat2CatUIImage.swift
- rm SampleSwiftMacApp/Cat2CatExampleSwiftMac/Cat2CatExampleSwiftMac/Cat2CatNSImage.swift

matrix:
include:
- xcode_project: SampleiOSApp/Cat2CatExample/Cat2CatExample.xcodeproj
xcode_scheme: Cat2CatExample
xcode_sdk: iphonesimulator9.0
- xcode_project: SampleMacApp/Cat2CatExampleMac/Cat2CatExampleMac.xcodeproj
xcode_scheme: Cat2CatExampleMac
xcode_sdk: macosx10.11
- xcode_project: SampleSwiftiOSApp/Cat2CatExampleSwift/Cat2CatExampleSwift.xcodeproj
xcode_scheme: Cat2CatExampleSwift
xcode_sdk: iphonesimulator9.0
- xcode_project: SampleSwiftMacApp/Cat2CatExampleSwiftMac/Cat2CatExampleSwiftMac.xcodeproj
xcode_scheme: Cat2CatExampleSwiftMac
xcode_sdk: macosx10.11
env:
global:
- SCAN_SKIP_BUILD=1
- SCAN_CONFIGURATION="Release"
matrix:
# Define the details for each test suite that should be run
- SCAN_PROJECT="SampleiOSApp/Cat2CatExample/Cat2CatExample.xcodeproj" SCAN_SCHEME="Cat2CatExample" SCAN_SDK="iphonesimulator"
- SCAN_PROJECT="SampleMacApp/Cat2CatExampleMac/Cat2CatExampleMac.xcodeproj" SCAN_SCHEME="Cat2CatExampleMac" SCAN_SDK="macosx"
- SCAN_PROJECT="SampleSwiftiOSApp/Cat2CatExampleSwift/Cat2CatExampleSwift.xcodeproj" SCAN_SCHEME="Cat2CatExampleSwift" SCAN_SDK="iphonesimulator"
- SCAN_PROJECT="SampleSwiftMacApp/Cat2CatExampleSwiftMac/Cat2CatExampleSwiftMac.xcodeproj" SCAN_SCHEME="Cat2CatExampleSwiftMac" SCAN_SDK="macosx"
script: bundle exec scan
cache:
- bundler # After main-repo builds, save the "bundler" (local Ruby gems) stuff to cache for future builds.
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'scan', '~>0.13'
57 changes: 57 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,57 @@
GEM
remote: https://rubygems.org/
specs:
babosa (1.0.2)
colored (1.2)
commander (4.4.0)
highline (~> 1.7.2)
credentials_manager (0.16.2)
colored
commander (>= 4.3.5)
highline (>= 1.7.1)
security
excon (0.54.0)
fastlane_core (0.55.0)
babosa
colored
commander (>= 4.4.0, <= 5.0.0)
credentials_manager (>= 0.16.2, < 1.0.0)
excon (>= 0.45.0, < 1.0)
gh_inspector (>= 1.0.1, < 2.0.0)
highline (>= 1.7.2)
json
multi_json
plist (>= 3.1.0, < 4.0.0)
rubyzip (~> 1.1.6)
terminal-table (>= 1.4.5, < 2.0.0)
gh_inspector (1.0.2)
highline (1.7.8)
json (2.0.2)
multi_json (1.12.1)
plist (3.2.0)
rouge (1.11.1)
rubyzip (1.1.7)
scan (0.13.1)
fastlane_core (>= 0.52.1, < 1.0.0)
slack-notifier (~> 1.3)
terminal-table
xcpretty (>= 0.2.2)
xcpretty-travis-formatter (>= 0.0.3)
security (0.1.3)
slack-notifier (1.5.1)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
unicode-display_width (1.1.1)
xcpretty (0.2.4)
rouge (~> 1.8)
xcpretty-travis-formatter (0.0.4)
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
ruby

DEPENDENCIES
scan (~> 0.13)

BUNDLED WITH
1.13.1
Expand Up @@ -191,9 +191,11 @@
TargetAttributes = {
7154C7EF1A08024F00862522 = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0810;
};
7154C7FF1A08024F00862522 = {
CreatedOnToolsVersion = 6.1;
LastSwiftMigration = 0810;
TestTargetID = 7154C7EF1A08024F00862522;
};
7154C8181A08039E00862522 = {
Expand Down Expand Up @@ -392,6 +394,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.vokalinteractive.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -404,6 +407,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.vokalinteractive.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand All @@ -424,6 +428,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.vokalinteractive.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Cat2CatExampleSwiftMac.app/Contents/MacOS/Cat2CatExampleSwiftMac";
};
name = Debug;
Expand All @@ -441,6 +446,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.vokalinteractive.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Cat2CatExampleSwiftMac.app/Contents/MacOS/Cat2CatExampleSwiftMac";
};
name = Release;
Expand Down
Expand Up @@ -16,7 +16,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
var windowController: WindowController?


func applicationDidFinishLaunching(aNotification: NSNotification) {
func applicationDidFinishLaunching(_ aNotification: Notification) {
windowController = WindowController(windowNibName: "WindowController")
window = windowController?.window
}
Expand Down
Expand Up @@ -30,7 +30,7 @@ class WindowController: NSWindowController {
setRandomImage(nil)
}

@IBAction func setRandomImage(sender: NSButton?) {
@IBAction func setRandomImage(_ sender: NSButton?) {
let randomIndex = Int(arc4random_uniform(UInt32(images.count)))
imageView?.image = images[randomIndex]
}
Expand Down
Expand Up @@ -30,8 +30,8 @@ class Cat2CatExampleSwiftMacTests: XCTestCase {

let methodRetreived = NSImage.ac_US_Capitol()

let imageNamedData = imageNamed.TIFFRepresentation
let methodReterivedData = methodRetreived.TIFFRepresentation
let imageNamedData = imageNamed.tiffRepresentation
let methodReterivedData = methodRetreived.tiffRepresentation

// Compare the data of the two images. Note that comparing the images directly doesn't work since that tests whether they're the same instance, not whether they have identical data.
XCTAssertTrue(imageNamedData == methodReterivedData, "Capitol images are not equal!")
Expand Down

0 comments on commit 7d1a4ab

Please sign in to comment.