From 236eb153a04068f16f6a0b4a2982f6a62b00968e Mon Sep 17 00:00:00 2001 From: WorldDownTown Date: Mon, 10 Apr 2017 00:31:38 +0900 Subject: [PATCH] add TapticEngine --- .gitignore | 3 + .swift-version | 1 + Info.plist | 26 + README.md | 75 ++- Sources/TapticEngine/TapticEngine.swift | 88 ++++ TapticEngine.podspec | 18 + TapticEngine.xcodeproj/project.pbxproj | 496 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcschemes/TapticEngine.xcscheme | 80 +++ TapticEngineDemo/AppDelegate.swift | 15 + .../AppIcon.appiconset/Contents.json | 93 ++++ .../Base.lproj/LaunchScreen.storyboard | 27 + TapticEngineDemo/Base.lproj/Main.storyboard | 97 ++++ TapticEngineDemo/Info.plist | 45 ++ TapticEngineDemo/ViewController.swift | 41 ++ 15 files changed, 1111 insertions(+), 1 deletion(-) create mode 100644 .swift-version create mode 100644 Info.plist create mode 100644 Sources/TapticEngine/TapticEngine.swift create mode 100644 TapticEngine.podspec create mode 100644 TapticEngine.xcodeproj/project.pbxproj create mode 100644 TapticEngine.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 TapticEngine.xcodeproj/xcshareddata/xcschemes/TapticEngine.xcscheme create mode 100644 TapticEngineDemo/AppDelegate.swift create mode 100644 TapticEngineDemo/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 TapticEngineDemo/Base.lproj/LaunchScreen.storyboard create mode 100644 TapticEngineDemo/Base.lproj/Main.storyboard create mode 100644 TapticEngineDemo/Info.plist create mode 100644 TapticEngineDemo/ViewController.swift diff --git a/.gitignore b/.gitignore index 2c22487..a9eb3fb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore +## mac +.DS_Store + ## Build generated build/ DerivedData/ diff --git a/.swift-version b/.swift-version new file mode 100644 index 0000000..8c50098 --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +3.1 diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..d3de8ee --- /dev/null +++ b/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/README.md b/README.md index 065066f..93aae06 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,75 @@ # TapticEngine -This library generates vibrations by Taptic Engine. + +[![License](https://img.shields.io/:license-mit-blue.svg)](https://doge.mit-license.org) +[![Language](https://img.shields.io/badge/language-swift-orange.svg?style=flat)](https://developer.apple.com/swift) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![CocoaPods compatible](https://img.shields.io/cocoapods/v/TapticEngine.svg?style=flat)](http://cocoadocs.org/docsets/TapticEngine/) +[![Downloads with CocoaPods](https://img.shields.io/cocoapods/dt/TapticEngine.svg)](http://cocoadocs.org/docsets/TapticEngine/) + +## Overview +"TapticEngine" generates iOS Device vibrations. +This library wrapps on [UIImpactFeedbackGenerator](https://developer.apple.com/reference/uikit/uiimpactfeedbackgenerator), [UISelectionFeedbackGenerator](https://develo per.apple.com/reference/uikit/uiselectionfeedbackgenerator), [UINotificationFeedbackGenerator](https://developer.apple.com/reference/uikit/uinotificationfeedbackgenerator). + +demo_screenshot + +## Demo +Build Xcode project. + +1. Open TapticEngine.xcodeproj. +2. Change Scheme to `TapticEngineDemo` +3. Run + +## Usage + +```swift +// Triggers a impact feedback between small, light user interface elements. (`UIImpactFeedbackStyle.light`) +TapticEngine.feedback(.light) + +// Triggers a impact feedback between moderately sized user interface elements. (`UIImpactFeedbackStyle.medium`) +TapticEngine.feedback(.medium) + +// Triggers a impact feedback between large, heavy user interface elements. (`UIImpactFeedbackStyle.heavy`) +TapticEngine.feedback(.heavy) + +// Triggers a selection feedback to communicate movement through a series of discrete values. +TapticEngine.feedback(.selection) + +// Triggers a notification feedback, indicating that a task has completed successfully. (`UINotificationFeedbackType.success`) +TapticEngine.feedback(.success) + +// Triggers a notification feedback, indicating that a task has produced a warning. (`UINotificationFeedbackType.warning`) +TapticEngine.feedback(.warning) + +// Triggers a notification feedback, indicating that a task has failed. (`UINotificationFeedbackType.error`) +TapticEngine.feedback(.error) +``` + +## Requirements +- Swift 3.0+ +- iOS 9.0+ (**But it works on iOS 10 or later. On iOS 9, it does nothing.**) + +## Installation + +### Carthage +TapticEngine is available through [Carthage](https://github.com/Carthage/Carthage). To install it, simply add the following line to your Cartfile: + +``` +github "WorldDownTown/TapticEngine" +``` + +### CocoaPods +TapticEngine is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: + +```ruby +pod 'TapticEngine' +``` + +### Manually +Download and drop `TapticEngine/Sources` folder in your project. + +## Author +WorldDownTown, WorldDownTown@gmail.com + +## License +TapticEngine is available under the MIT license. See the LICENSE file for more info. + diff --git a/Sources/TapticEngine/TapticEngine.swift b/Sources/TapticEngine/TapticEngine.swift new file mode 100644 index 0000000..e686b68 --- /dev/null +++ b/Sources/TapticEngine/TapticEngine.swift @@ -0,0 +1,88 @@ +// +// TapticEngine.swift +// TapticEngine +// +// Created by Keisuke Shoji on 2017/04/09. +// Copyright © 2017年 Keisuke Shoji. All rights reserved. +// + +import UIKit + +/// Generates iOS Device vibrations by UIFeedbackGenerator. +public struct TapticEngine { + + /// Feedback vibration types + /// + /// - light: A impact feedback between small, light user interface elements. + /// - medium: A impact feedback between moderately sized user interface elements. + /// - heavy: A impact feedback between large, heavy user interface elements. + /// - selection: A selection feedback to communicate movement through a series of discrete values. + /// - success: A notification feedback, indicating that a task has completed successfully. + /// - warning: A notification feedback, indicating that a task has produced a warning. + /// - error: A notification feedback, indicating that a task has failed. + public enum FeedbackType { + case light, medium, heavy, selection, success, warning, error + } + + /// Triggers feedback. + /// + /// - Parameter type: Feedback style + public static func feedback(_ type: FeedbackType = .light) { + switch type { + case .light, .medium, .heavy: + feedbackImpact(type) + case .selection: + feedbackSelection() + case .success, .warning, .error: + feedbackNotification(type) + } + } + + private static func feedbackImpact(_ type: FeedbackType) { + guard #available(iOS 10.0, *) else { return } + + let feedbackStyle: UIImpactFeedbackStyle + switch type { + case .light: + feedbackStyle = .light + case .medium: + feedbackStyle = .medium + case .heavy: + feedbackStyle = .heavy + default: + return + } + + let feedbackGenerator: UIImpactFeedbackGenerator = UIImpactFeedbackGenerator(style: feedbackStyle) + feedbackGenerator.prepare() + feedbackGenerator.impactOccurred() + } + + private static func feedbackSelection() { + guard #available(iOS 10.0, *) else { return } + + let feedbackGenerator: UISelectionFeedbackGenerator = UISelectionFeedbackGenerator() + feedbackGenerator.prepare() + feedbackGenerator.selectionChanged() + } + + private static func feedbackNotification(_ type: FeedbackType) { + guard #available(iOS 10.0, *) else { return } + + let feedbackType: UINotificationFeedbackType + switch type { + case .success: + feedbackType = .success + case .warning: + feedbackType = .warning + case .error: + feedbackType = .error + default: + return + } + + let feedbackGenerator: UINotificationFeedbackGenerator = UINotificationFeedbackGenerator() + feedbackGenerator.prepare() + feedbackGenerator.notificationOccurred(feedbackType) + } +} diff --git a/TapticEngine.podspec b/TapticEngine.podspec new file mode 100644 index 0000000..f5f8e5f --- /dev/null +++ b/TapticEngine.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |s| + s.name = 'TapticEngine' + s.version = '1.0.0' + s.summary = '"TapticEngine" generates iOS Device vibrations.' + s.description = <<-DESC + "TapticEngine" generates iOS Device vibrations. + This library wrapps on [UIImpactFeedbackGenerator](https://developer.apple.com/reference/uikit/uiimpactfeedbackgenerator), [UISelectionFeedbackGenerator](https://developer.apple.com/reference/uikit/uiselectionfeedbackgenerator), [UINotificationFeedbackGenerator](https://developer.apple.com/reference/uikit/uinotificationfeedbackgenerator). + DESC + s.homepage = 'https://github.com/WorldDownTown/TapticEngine' + s.screenshots = 'https://dl2.pushbulletusercontent.com/TKSfPYAu8pl5NARwARj2E3j87llwnXcs/taptic_engine.png' + s.license = { type: 'MIT', file: 'LICENSE' } + s.author = { WorldDownTown: 'WorldDownTown@gmail.com' } + s.source = { git: 'https://github.com/WorldDownTown/TapticEngine.git', tag: s.version.to_s } + s.social_media_url = 'https://twitter.com/WorldDownTown' + s.ios.deployment_target = '9.0' + s.source_files = 'Sources/**/*.swift' + s.frameworks = ['UIKit'] +end diff --git a/TapticEngine.xcodeproj/project.pbxproj b/TapticEngine.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6f62d2d --- /dev/null +++ b/TapticEngine.xcodeproj/project.pbxproj @@ -0,0 +1,496 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + CE22A5511E9A767900E27AA6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE22A5501E9A767900E27AA6 /* UIKit.framework */; }; + CE9EC9231E9A7B9B0084FCC4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9EC9221E9A7B9B0084FCC4 /* AppDelegate.swift */; }; + CE9EC9251E9A7BA30084FCC4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE9EC9241E9A7BA30084FCC4 /* ViewController.swift */; }; + CE9EC92A1E9A7BB00084FCC4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE9EC9261E9A7BB00084FCC4 /* LaunchScreen.storyboard */; }; + CE9EC92B1E9A7BB00084FCC4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE9EC9281E9A7BB00084FCC4 /* Main.storyboard */; }; + CE9EC9311E9A7BD60084FCC4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE9EC9301E9A7BD60084FCC4 /* Assets.xcassets */; }; + CE9EC9321E9A7BEA0084FCC4 /* TapticEngine.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CED395991E9A6FBF0087D721 /* TapticEngine.framework */; }; + CE9EC9331E9A7BEA0084FCC4 /* TapticEngine.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CED395991E9A6FBF0087D721 /* TapticEngine.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + CED395A91E9A701E0087D721 /* TapticEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED395A81E9A701E0087D721 /* TapticEngine.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + CE9EC9341E9A7BEA0084FCC4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = CE7BF1401E9A6F1A00A4812F /* Project object */; + proxyType = 1; + remoteGlobalIDString = CED395981E9A6FBF0087D721; + remoteInfo = TapticEngine; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + CE9EC9361E9A7BEA0084FCC4 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + CE9EC9331E9A7BEA0084FCC4 /* TapticEngine.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + CE22A5501E9A767900E27AA6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + CE9EC9101E9A7A900084FCC4 /* TapticEngineDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TapticEngineDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CE9EC9221E9A7B9B0084FCC4 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + CE9EC9241E9A7BA30084FCC4 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + CE9EC9271E9A7BB00084FCC4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + CE9EC9291E9A7BB00084FCC4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + CE9EC92E1E9A7BC90084FCC4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CE9EC9301E9A7BD60084FCC4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + CED395991E9A6FBF0087D721 /* TapticEngine.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TapticEngine.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CED395A81E9A701E0087D721 /* TapticEngine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TapticEngine.swift; path = Sources/TapticEngine/TapticEngine.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CE9EC90D1E9A7A900084FCC4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CE9EC9321E9A7BEA0084FCC4 /* TapticEngine.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CED395951E9A6FBF0087D721 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CE22A5511E9A767900E27AA6 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CE22A54F1E9A764100E27AA6 /* Frameworks */ = { + isa = PBXGroup; + children = ( + CE22A5501E9A767900E27AA6 /* UIKit.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + CE7BF13F1E9A6F1A00A4812F = { + isa = PBXGroup; + children = ( + CED395A61E9A6FF30087D721 /* Sources */, + CE9EC9111E9A7A900084FCC4 /* TapticEngineDemo */, + CE7BF1491E9A6F1A00A4812F /* Products */, + CE22A54F1E9A764100E27AA6 /* Frameworks */, + ); + sourceTree = ""; + }; + CE7BF1491E9A6F1A00A4812F /* Products */ = { + isa = PBXGroup; + children = ( + CED395991E9A6FBF0087D721 /* TapticEngine.framework */, + CE9EC9101E9A7A900084FCC4 /* TapticEngineDemo.app */, + ); + name = Products; + sourceTree = ""; + }; + CE9EC9111E9A7A900084FCC4 /* TapticEngineDemo */ = { + isa = PBXGroup; + children = ( + CE9EC92E1E9A7BC90084FCC4 /* Info.plist */, + CE9EC9221E9A7B9B0084FCC4 /* AppDelegate.swift */, + CE9EC9241E9A7BA30084FCC4 /* ViewController.swift */, + CE9EC9301E9A7BD60084FCC4 /* Assets.xcassets */, + CE9EC9261E9A7BB00084FCC4 /* LaunchScreen.storyboard */, + CE9EC9281E9A7BB00084FCC4 /* Main.storyboard */, + ); + path = TapticEngineDemo; + sourceTree = ""; + }; + CED395A61E9A6FF30087D721 /* Sources */ = { + isa = PBXGroup; + children = ( + CED395A71E9A6FFB0087D721 /* TapticEngine */, + ); + name = Sources; + sourceTree = ""; + }; + CED395A71E9A6FFB0087D721 /* TapticEngine */ = { + isa = PBXGroup; + children = ( + CED395A81E9A701E0087D721 /* TapticEngine.swift */, + ); + name = TapticEngine; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + CED395961E9A6FBF0087D721 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + CE9EC90F1E9A7A900084FCC4 /* TapticEngineDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = CE9EC91F1E9A7A900084FCC4 /* Build configuration list for PBXNativeTarget "TapticEngineDemo" */; + buildPhases = ( + CE9EC90C1E9A7A900084FCC4 /* Sources */, + CE9EC90D1E9A7A900084FCC4 /* Frameworks */, + CE9EC90E1E9A7A900084FCC4 /* Resources */, + CE9EC9361E9A7BEA0084FCC4 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + CE9EC9351E9A7BEA0084FCC4 /* PBXTargetDependency */, + ); + name = TapticEngineDemo; + productName = TapticEngineDemo; + productReference = CE9EC9101E9A7A900084FCC4 /* TapticEngineDemo.app */; + productType = "com.apple.product-type.application"; + }; + CED395981E9A6FBF0087D721 /* TapticEngine */ = { + isa = PBXNativeTarget; + buildConfigurationList = CED395A21E9A6FBF0087D721 /* Build configuration list for PBXNativeTarget "TapticEngine" */; + buildPhases = ( + CED395941E9A6FBF0087D721 /* Sources */, + CED395951E9A6FBF0087D721 /* Frameworks */, + CED395961E9A6FBF0087D721 /* Headers */, + CED395971E9A6FBF0087D721 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TapticEngine; + productName = TapticEngine; + productReference = CED395991E9A6FBF0087D721 /* TapticEngine.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CE7BF1401E9A6F1A00A4812F /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = "Keisuke Shoji"; + TargetAttributes = { + CE9EC90F1E9A7A900084FCC4 = { + CreatedOnToolsVersion = 8.3.1; + DevelopmentTeam = S3LY459S86; + ProvisioningStyle = Automatic; + }; + CED395981E9A6FBF0087D721 = { + CreatedOnToolsVersion = 8.3.1; + DevelopmentTeam = S3LY459S86; + LastSwiftMigration = 0830; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = CE7BF1431E9A6F1A00A4812F /* Build configuration list for PBXProject "TapticEngine" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CE7BF13F1E9A6F1A00A4812F; + productRefGroup = CE7BF1491E9A6F1A00A4812F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CED395981E9A6FBF0087D721 /* TapticEngine */, + CE9EC90F1E9A7A900084FCC4 /* TapticEngineDemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CE9EC90E1E9A7A900084FCC4 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CE9EC92B1E9A7BB00084FCC4 /* Main.storyboard in Resources */, + CE9EC9311E9A7BD60084FCC4 /* Assets.xcassets in Resources */, + CE9EC92A1E9A7BB00084FCC4 /* LaunchScreen.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CED395971E9A6FBF0087D721 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CE9EC90C1E9A7A900084FCC4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CE9EC9251E9A7BA30084FCC4 /* ViewController.swift in Sources */, + CE9EC9231E9A7B9B0084FCC4 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CED395941E9A6FBF0087D721 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CED395A91E9A701E0087D721 /* TapticEngine.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + CE9EC9351E9A7BEA0084FCC4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = CED395981E9A6FBF0087D721 /* TapticEngine */; + targetProxy = CE9EC9341E9A7BEA0084FCC4 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + CE9EC9261E9A7BB00084FCC4 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CE9EC9271E9A7BB00084FCC4 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; + CE9EC9281E9A7BB00084FCC4 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CE9EC9291E9A7BB00084FCC4 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + CE7BF1581E9A6F1A00A4812F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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; + DEBUG_INFORMATION_FORMAT = dwarf; + 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", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + CE7BF1591E9A6F1A00A4812F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + 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; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + CE9EC9201E9A7A900084FCC4 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = S3LY459S86; + INFOPLIST_FILE = TapticEngineDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shoji.TapticEngineDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + CE9EC9211E9A7A900084FCC4 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = S3LY459S86; + INFOPLIST_FILE = TapticEngineDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shoji.TapticEngineDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + CED395A31E9A6FBF0087D721 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = S3LY459S86; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shoji.TapticEngine; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + CED395A41E9A6FBF0087D721 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = S3LY459S86; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.shoji.TapticEngine; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CE7BF1431E9A6F1A00A4812F /* Build configuration list for PBXProject "TapticEngine" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CE7BF1581E9A6F1A00A4812F /* Debug */, + CE7BF1591E9A6F1A00A4812F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CE9EC91F1E9A7A900084FCC4 /* Build configuration list for PBXNativeTarget "TapticEngineDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CE9EC9201E9A7A900084FCC4 /* Debug */, + CE9EC9211E9A7A900084FCC4 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + CED395A21E9A6FBF0087D721 /* Build configuration list for PBXNativeTarget "TapticEngine" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CED395A31E9A6FBF0087D721 /* Debug */, + CED395A41E9A6FBF0087D721 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CE7BF1401E9A6F1A00A4812F /* Project object */; +} diff --git a/TapticEngine.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TapticEngine.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..71de582 --- /dev/null +++ b/TapticEngine.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/TapticEngine.xcodeproj/xcshareddata/xcschemes/TapticEngine.xcscheme b/TapticEngine.xcodeproj/xcshareddata/xcschemes/TapticEngine.xcscheme new file mode 100644 index 0000000..bea00f1 --- /dev/null +++ b/TapticEngine.xcodeproj/xcshareddata/xcschemes/TapticEngine.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TapticEngineDemo/AppDelegate.swift b/TapticEngineDemo/AppDelegate.swift new file mode 100644 index 0000000..cebf343 --- /dev/null +++ b/TapticEngineDemo/AppDelegate.swift @@ -0,0 +1,15 @@ +// +// AppDelegate.swift +// TapticEngineDemo +// +// Created by Keisuke Shoji on 2017/04/09. +// Copyright © 2017年 Keisuke Shoji. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? +} diff --git a/TapticEngineDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/TapticEngineDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..1d060ed --- /dev/null +++ b/TapticEngineDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TapticEngineDemo/Base.lproj/LaunchScreen.storyboard b/TapticEngineDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..fdf3f97 --- /dev/null +++ b/TapticEngineDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TapticEngineDemo/Base.lproj/Main.storyboard b/TapticEngineDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..cffbbdf --- /dev/null +++ b/TapticEngineDemo/Base.lproj/Main.storyboard @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TapticEngineDemo/Info.plist b/TapticEngineDemo/Info.plist new file mode 100644 index 0000000..d052473 --- /dev/null +++ b/TapticEngineDemo/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/TapticEngineDemo/ViewController.swift b/TapticEngineDemo/ViewController.swift new file mode 100644 index 0000000..6c48bbf --- /dev/null +++ b/TapticEngineDemo/ViewController.swift @@ -0,0 +1,41 @@ +// +// ViewController.swift +// TapticEngineDemo +// +// Created by Keisuke Shoji on 2017/04/09. +// Copyright © 2017年 Keisuke Shoji. All rights reserved. +// + +import UIKit +import TapticEngine + +class ViewController: UIViewController { + + @IBAction private func light() { + TapticEngine.feedback(.light) + } + + @IBAction private func medium() { + TapticEngine.feedback(.medium) + } + + @IBAction private func heavy() { + TapticEngine.feedback(.heavy) + } + + @IBAction private func selection() { + TapticEngine.feedback(.selection) + } + + @IBAction private func success() { + TapticEngine.feedback(.success) + } + + @IBAction private func warning() { + TapticEngine.feedback(.warning) + } + + @IBAction private func error() { + TapticEngine.feedback(.error) + } +}