Skip to content

Commit

Permalink
Merge pull request #72 from norman93sun/master
Browse files Browse the repository at this point in the history
Example update to swift 5
  • Loading branch information
vadymmarkov committed Jan 28, 2021
2 parents 774fe12 + e8147f4 commit 2d8cb53
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 65 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
51 changes: 10 additions & 41 deletions Example/GuitarTuner/GuitarTuner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@
D57D40FA1BE95A350026B005 /* Frameworks */,
D57D40FB1BE95A350026B005 /* Resources */,
9A1FE1805890F1ADECBB5C91 /* [CP] Embed Pods Frameworks */,
C388AD861F71DDEC8588850E /* [CP] Copy Pods Resources */,
BBF9D165E87DC40FC3115EAE /* 📦 Embed Pods Frameworks */,
6F77F9EE9820226CF5C57DF3 /* 📦 Copy Pods Resources */,
);
buildRules = (
);
Expand All @@ -150,7 +148,7 @@
TargetAttributes = {
D57D40FC1BE95A350026B005 = {
CreatedOnToolsVersion = 7.0.1;
DevelopmentTeam = 6YMA3EN78R;
DevelopmentTeam = KMUT74CVY5;
LastSwiftMigration = 0900;
};
};
Expand All @@ -160,6 +158,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -219,28 +218,13 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
6F77F9EE9820226CF5C57DF3 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9A1FE1805890F1ADECBB5C91 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Beethoven/Beethoven.framework",
"${BUILT_PRODUCTS_DIR}/Cartography/Cartography.framework",
"${BUILT_PRODUCTS_DIR}/Hue/Hue.framework",
Expand All @@ -255,7 +239,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
BBF9D165E87DC40FC3115EAE /* 📦 Embed Pods Frameworks */ = {
Expand All @@ -273,21 +257,6 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C388AD861F71DDEC8588850E /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GuitarTuner/Pods-GuitarTuner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -363,7 +332,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -409,7 +378,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -420,13 +389,13 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 6YMA3EN78R;
DEVELOPMENT_TEAM = KMUT74CVY5;
INFOPLIST_FILE = "$(SRCROOT)/GuitarTuner/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.vadymmarkov.GuitarTuner;
PRODUCT_NAME = GuitarTuner;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -436,13 +405,13 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 6YMA3EN78R;
DEVELOPMENT_TEAM = 4C97DN55EV;
INFOPLIST_FILE = "$(SRCROOT)/GuitarTuner/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.vadymmarkov.GuitarTuner;
PRODUCT_NAME = GuitarTuner;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Example/GuitarTuner/GuitarTuner/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var viewController: ViewController = .init()

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = navigationController

Expand All @@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
navigationBar.isTranslucent = false
navigationBar.shadowImage = UIImage()
navigationBar.titleTextAttributes = [
NSAttributedStringKey.foregroundColor: UIColor.white
NSAttributedString.Key.foregroundColor: UIColor.white
]
}
}
4 changes: 2 additions & 2 deletions Example/GuitarTuner/GuitarTuner/Source/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ final class ViewController: UIViewController {
button.layer.cornerRadius = 20
button.backgroundColor = UIColor(hex: "3DAFAE")
button.titleLabel?.font = UIFont.systemFont(ofSize: 20)
button.setTitleColor(UIColor.white, for: UIControlState())
button.setTitleColor(UIColor.white, for: UIControl.State())

button.addTarget(self, action: #selector(ViewController.actionButtonDidPress(_:)),
for: .touchUpInside)
button.setTitle("Start".uppercased(), for: UIControlState())
button.setTitle("Start".uppercased(), for: UIControl.State())

return button
}()
Expand Down
19 changes: 17 additions & 2 deletions Example/GuitarTuner/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ platform :ios, '9.0'

target 'GuitarTuner' do
pod 'Beethoven', path: '../../'
pod 'Hue', '~> 3.0'
pod 'Cartography'
pod 'Hue', '~> 5.0'
pod 'Cartography', '~> 3.0'
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings.delete('CODE_SIGNING_ALLOWED')
config.build_settings.delete('CODE_SIGNING_REQUIRED')
end
end
installer.pods_project.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
config.build_settings.delete('CODE_SIGNING_ALLOWED')
config.build_settings.delete('CODE_SIGNING_REQUIRED')
end
end
28 changes: 17 additions & 11 deletions Example/GuitarTuner/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
PODS:
- Beethoven (4.0.0):
- Beethoven (4.0.2):
- Pitchy (~> 3.0)
- Cartography (2.0.0)
- Hue (3.0.0)
- Cartography (3.1.0)
- Hue (5.0.0)
- Pitchy (3.0.0)

DEPENDENCIES:
- Beethoven (from `../../`)
- Cartography
- Hue (~> 3.0)
- Cartography (~> 3.0)
- Hue (~> 5.0)

SPEC REPOS:
trunk:
- Cartography
- Hue
- Pitchy

EXTERNAL SOURCES:
Beethoven:
:path: ../../
:path: "../../"

SPEC CHECKSUMS:
Beethoven: 0cb6d02eace9841d29fcb52f92334d2bd4c8e131
Cartography: d295eb25ab54bb57eecd8c2f04e9648c850f1281
Hue: b8fe1e43eef13631331eebecb2198b68e2622f95
Beethoven: 04f99571a7ad2a37184161762be757fe0b8ccc20
Cartography: 1988b7578871a56c036e7af17195cb2190edf18c
Hue: c129cb67be7d093a82bbbc30ce8a96757bf6f37a
Pitchy: 15407e4425b6d88fa3e7eef8927ba659fab52d7a

PODFILE CHECKSUM: 38c90b3edadf248124cd55d1086854ecf4e5c51b
PODFILE CHECKSUM: 36c8d115bba4c2b8ff7ae95956fd288002fa13e5

COCOAPODS: 1.3.1
COCOAPODS: 1.8.4
4 changes: 2 additions & 2 deletions Source/PitchEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public final class PitchEngine {

let audioSession = AVAudioSession.sharedInstance()

switch audioSession.recordPermission() {
switch audioSession.recordPermission {
case AVAudioSessionRecordPermission.granted:
activate()
case AVAudioSessionRecordPermission.denied:
DispatchQueue.main.async {
if let settingsURL = URL(string: UIApplicationOpenSettingsURLString) {
if let settingsURL = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.openURL(settingsURL)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/SignalTracking/SignalTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public protocol SignalTracker: class {
var levelThreshold: Float? { get set }
var peakLevel: Float? { get }
var averageLevel: Float? { get }
weak var delegate: SignalTrackerDelegate? { get set }
var delegate: SignalTrackerDelegate? { get set }

func start() throws
func stop()
Expand Down
6 changes: 3 additions & 3 deletions Source/SignalTracking/Units/InputSignalTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ final class InputSignalTracker: SignalTracker {
// MARK: - Tracking

func start() throws {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord)
try session.setCategory(AVAudioSession.Category.playAndRecord)

// check input type
let currentRoute = session.currentRoute
if currentRoute.outputs.count != 0 {
for description in currentRoute.outputs {
if (description.portType != AVAudioSessionPortHeadphones) { // input from speaker if port is not headphones
try session.overrideOutputAudioPort(AVAudioSessionPortOverride.speaker)
if (description.portType != AVAudioSession.Port.headphones) { // input from speaker if port is not headphones
try session.overrideOutputAudioPort(AVAudioSession.PortOverride.speaker)
} else { // input from default (headphones)
try session.overrideOutputAudioPort(.none)
}
Expand Down
2 changes: 1 addition & 1 deletion Source/SignalTracking/Units/OutputSignalTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class OutputSignalTracker: SignalTracker {

func start() throws {
let session = AVAudioSession.sharedInstance()
try session.setCategory(AVAudioSessionCategoryPlayback)
try session.setCategory(AVAudioSession.Category.playback)

audioEngine = AVAudioEngine()
audioPlayer = AVAudioPlayerNode()
Expand Down

0 comments on commit 2d8cb53

Please sign in to comment.