Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgraded classes to new swift 5 syntax #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions Classes/ESTMusicIndicatorContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ESTMusicIndicatorContentView: UIView {
animation.repeatCount = Float.infinity // Forever
animation.autoreverses = true
animation.duration = TimeInterval((CGFloat(basePeriod) / 2) * (kBarMaxPeakHeight / peakHeight))
animation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseIn)
animation.timingFunction = CAMediaTimingFunction.init(name: CAMediaTimingFunctionName.easeIn)

layer.add(animation, forKey: kOscillationAnimationKey)
}
Expand All @@ -188,7 +188,7 @@ class ESTMusicIndicatorContentView: UIView {
}
animation.toValue = NSValue(cgRect:layer.bounds)
animation.duration = kDecayDuration
animation.timingFunction = CAMediaTimingFunction.init(name: kCAMediaTimingFunctionEaseOut)
animation.timingFunction = CAMediaTimingFunction.init(name: CAMediaTimingFunctionName.easeOut)

layer.add(animation, forKey: kDecayAnimationKey)
}
Expand Down
12 changes: 6 additions & 6 deletions Classes/ESTMusicIndicatorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ open class ESTMusicIndicatorView: UIView {
addSubview(contentView)
prepareLayoutPriorities()
setNeedsUpdateConstraints()
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidEnterBackground(_:)), name: NSNotification.Name.UIApplicationDidEnterBackground, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidEnterBackground(_:)), name: UIApplication.didEnterBackgroundNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
}

private func prepareLayoutPriorities() {
// Custom views should set default values for both orientations on creation,
// based on their content, typically to NSLayoutPriorityDefaultLow or NSLayoutPriorityDefaultHigh.
setContentHuggingPriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.horizontal)
setContentHuggingPriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.vertical)
setContentHuggingPriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.horizontal)
setContentHuggingPriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.vertical)

setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.horizontal)
setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: UILayoutConstraintAxis.vertical)
setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.horizontal)
setContentCompressionResistancePriority(UILayoutPriority.defaultHigh, for: NSLayoutConstraint.Axis.vertical)
}

deinit {
Expand Down
26 changes: 15 additions & 11 deletions Example/ESTMusicIndicator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -246,28 +246,28 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1160;
ORGANIZATIONNAME = "The EST Group";
TargetAttributes = {
564E7FE71C14624500353CC0 = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0940;
LastSwiftMigration = 1160;
};
564E7FFB1C14624500353CC0 = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1160;
TestTargetID = 564E7FE71C14624500353CC0;
};
564E80061C14624500353CC0 = {
CreatedOnToolsVersion = 7.1.1;
LastSwiftMigration = 0900;
LastSwiftMigration = 1160;
TestTargetID = 564E7FE71C14624500353CC0;
};
};
};
buildConfigurationList = 564E7FE31C14624500353CC0 /* Build configuration list for PBXProject "ESTMusicIndicator" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -373,6 +373,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -420,13 +421,15 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
564E800F1C14624500353CC0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -467,6 +470,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -481,7 +485,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicator";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -495,7 +499,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicator";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -508,7 +512,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESTMusicIndicator.app/ESTMusicIndicator";
};
name = Debug;
Expand All @@ -522,7 +526,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorTests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ESTMusicIndicator.app/ESTMusicIndicator";
};
name = Release;
Expand All @@ -535,7 +539,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = ESTMusicIndicator;
USES_XCTRUNNER = YES;
};
Expand All @@ -549,7 +553,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.est-group.ESTMusicIndicatorUITests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = ESTMusicIndicator;
USES_XCTRUNNER = YES;
};
Expand Down