Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
swift 4
Browse files Browse the repository at this point in the history
  • Loading branch information
hongxinhope committed Sep 26, 2017
1 parent 3df4143 commit 3d5fee2
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "teambition/RefreshView" "master"
github "teambition/RefreshView"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "teambition/RefreshView" "a562333fa27b6f5ef41efb13014aedb5befec3c8"
github "teambition/RefreshView" "1.2.0"
24 changes: 20 additions & 4 deletions STTableBoard.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@
EB793B0A1C1E608900BF1148 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = StormXX;
TargetAttributes = {
EB793B121C1E608900BF1148 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
};
};
};
Expand Down Expand Up @@ -325,14 +325,20 @@
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;
Expand Down Expand Up @@ -361,6 +367,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -375,14 +382,20 @@
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;
Expand All @@ -404,6 +417,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -433,7 +447,8 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -458,7 +473,8 @@
PRODUCT_BUNDLE_IDENTIFIER = com.StormXX.STTableBoard;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -36,6 +37,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
10 changes: 5 additions & 5 deletions STTableBoard/Extensions/STTableBoardExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import UIKit

//MARK: - double tap
extension STTableBoard {
func handleDoubleTap(_ recognizer: UIGestureRecognizer) {
@objc func handleDoubleTap(_ recognizer: UIGestureRecognizer) {
tapPosition = recognizer.location(in: containerView)
dataSource?.tableBoard(self, scaleTableBoard: tableBoardMode == .page)
switchMode()
}

func handlePinch(_ recognizer: UIPinchGestureRecognizer) {
@objc func handlePinch(_ recognizer: UIPinchGestureRecognizer) {
delegate?.tableBoard(self, handlePinchGesture: recognizer)
}

Expand Down Expand Up @@ -47,7 +47,7 @@ extension STTableBoard {

//MARK: - long press drag for board
extension STTableBoard {
func handleLongPressGestureForBoard(_ recognizer: UIGestureRecognizer) {
@objc func handleLongPressGestureForBoard(_ recognizer: UIGestureRecognizer) {
switch recognizer.state {
case .began:
startMovingBoard(recognizer)
Expand Down Expand Up @@ -142,7 +142,7 @@ extension STTableBoard {

//MARK: - long press drag for cell
extension STTableBoard {
func handleLongPressGestureForCell(_ recognizer: UIGestureRecognizer) {
@objc func handleLongPressGestureForCell(_ recognizer: UIGestureRecognizer) {
switch recognizer.state {
case .began:
startMovingRow(recognizer)
Expand Down Expand Up @@ -404,7 +404,7 @@ extension STTableBoard {
tableViewAutoScrollDistance = min(tableViewAutoScrollDistance, maximumDistance)
}

func tableViewAutoScrollTimerFired(_ timer: Timer) {
@objc func tableViewAutoScrollTimerFired(_ timer: Timer) {
guard let userInfo = timer.userInfo as? [String:AnyObject], let tableView = userInfo[timerUserInfoTableViewKey] as? STShadowTableView else { return }
optimizeTableViewScrollDistance(tableView)

Expand Down
2 changes: 1 addition & 1 deletion STTableBoard/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>0.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
8 changes: 4 additions & 4 deletions STTableBoard/ViewControllers/STTableBoard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ open class STTableBoard: UIViewController {
scrollView.frame = CGRect(origin: CGPoint.zero, size: size)
scrollView.contentSize = CGSize(width: scrollView.contentSize.width, height: size.height)
containerView.frame = CGRect(origin: CGPoint.zero, size: scrollView.contentSize)
UIView.animate(withDuration: 0.5, animations: { (finished) in
UIView.animate(withDuration: 0.5) {
self.pageControl.frame = CGRect(x: 0, y: size.height - self.pageControl.height, width: size.width, height: pageControlHeight)
})
}
boards.forEach { (board) -> () in
autoAdjustTableBoardHeight(board, animated: true)
}
Expand All @@ -319,7 +319,7 @@ open class STTableBoard: UIViewController {

//MARK: - response method
extension STTableBoard {
func keyboardWillShow(_ notification: Notification) {
@objc func keyboardWillShow(_ notification: Notification) {
if let userInfo = notification.userInfo, let keyboardFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue {
let keyboardFrame = keyboardFrameValue.cgRectValue
let keyboardHeight = keyboardFrame.height
Expand All @@ -337,7 +337,7 @@ extension STTableBoard {
}
}

func keyboardWillHide(_ notification: Notification) {
@objc func keyboardWillHide(_ notification: Notification) {
guard let _ = self.originFrame else { return }
UIView.animate(withDuration: 0.33, animations: { [weak self]() -> Void in
guard let `self` = self else { return }
Expand Down
2 changes: 1 addition & 1 deletion STTableBoard/Views/NewBoardButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NewBoardButton: UIView {
NSLayoutConstraint.activate(horizontalConstraints + [imageViewHeight, imageViewCenterY])
}

func viewDidBeClicked() {
@objc func viewDidBeClicked() {
delegate?.newBoardButtonDidBeClicked(newBoardButton: self)
}

Expand Down
2 changes: 1 addition & 1 deletion STTableBoard/Views/STBoardFooterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class STBoardFooterView: UIView {
NSLayoutConstraint.activate(titleButtonHorizontalConstraints + titleButtonVerticalConstraints)
}

func addButtonTapped(_ sender: UIButton?) {
@objc func addButtonTapped(_ sender: UIButton?) {
if let boardView = boardView, let customAction = boardView.delegate?.customAddRowAction(for: boardView) {
customAction()
return
Expand Down
8 changes: 4 additions & 4 deletions STTableBoard/Views/STBoardHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class STBoardHeaderView: UIView {
label.textAlignment = .left
label.font = TableBoardCommonConstant.labelFont
label.textColor = UIColor.darkGrayTextColor
label.setContentHuggingPriority(UILayoutPriorityDefaultHigh, for: .horizontal)
label.setContentCompressionResistancePriority(UILayoutPriorityDefaultLow, for: .horizontal)
label.setContentHuggingPriority(.defaultHigh, for: .horizontal)
label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
return label
}()

Expand All @@ -39,7 +39,7 @@ class STBoardHeaderView: UIView {
label.textAlignment = .left
label.font = TableBoardCommonConstant.labelFont
label.textColor = UIColor.darkGrayTextColor
label.setContentCompressionResistancePriority(UILayoutPriorityDefaultHigh, for: .horizontal)
label.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
return label
}()

Expand Down Expand Up @@ -92,7 +92,7 @@ class STBoardHeaderView: UIView {

}

func actionButtonBeClicked(_ sender: UIButton) {
@objc func actionButtonBeClicked(_ sender: UIButton) {
if let boardView = boardView {
boardView.delegate?.boardView(boardView, didClickBoardMenuButton: sender)
}
Expand Down
4 changes: 2 additions & 2 deletions STTableBoard/Views/TextComposeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ class TextComposeView: UIView {
self.init(frame: frame, textFieldHeight: 56.0, cornerRadius: 4.0)
}

func cancelButtonClicked(_ sender: UIButton) {
@objc func cancelButtonClicked(_ sender: UIButton) {
textField.resignFirstResponder()
delegate?.textComposeView(textComposeView: self, didClickCancelButton: sender)
}

func doneButtonClicked(_ sender: UIButton) {
@objc func doneButtonClicked(_ sender: UIButton) {
if let text = textField.text {
let trimedText = text.trim()
if trimedText.characters.count > 0 {
Expand Down
34 changes: 27 additions & 7 deletions STTableBoardDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = StormXX;
TargetAttributes = {
EB793BA51C1E653400BF1148 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = DHNJ8N28ZZ;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Manual;
};
};
};
Expand Down Expand Up @@ -266,14 +266,20 @@
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;
Expand Down Expand Up @@ -301,6 +307,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -312,14 +319,20 @@
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;
Expand All @@ -340,6 +353,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -350,7 +364,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = DHNJ8N28ZZ;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -362,7 +377,9 @@
PRODUCT_BUNDLE_IDENTIFIER = com.StormXX.STTableBoardDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -373,7 +390,8 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = DHNJ8N28ZZ;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)",
Expand All @@ -385,7 +403,9 @@
PRODUCT_BUNDLE_IDENTIFIER = com.StormXX.STTableBoardDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion STTableBoardDemo/BadgeListView/BadgeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ open class BadgeView: UIView {
}

override open var intrinsicContentSize : CGSize {
var size = titleLabel.text?.size(attributes: [NSFontAttributeName: textFont]) ?? CGSize.zero
var size = titleLabel.text?.size(withAttributes: [.font: textFont]) ?? CGSize.zero

size.height += 2 * titlePaddingY
if let _ = image {
Expand Down
Loading

0 comments on commit 3d5fee2

Please sign in to comment.