Skip to content

Commit

Permalink
master: Migrated to Swift 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
raginmari committed May 27, 2019
1 parent f8d43db commit 4575ed5
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 22 deletions.
15 changes: 8 additions & 7 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions Example/RAGTextField.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,23 +293,23 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
TestTargetID = 607FACCF1AFB9204008FA782;
};
};
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "RAGTextField" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -508,6 +508,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 @@ -563,6 +564,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 @@ -619,8 +621,7 @@
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -636,8 +637,7 @@
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -658,8 +658,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -676,8 +675,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.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 = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions Example/RAGTextField/TextAlignmentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ final class TextAlignmentViewController: UIViewController, UITextFieldDelegate {
return "Natural alignment"
case .justified:
return "Justified alignment"
@unknown default:
return "Unknown alignment"
}
}

Expand Down
2 changes: 1 addition & 1 deletion RAGTextField.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Pod::Spec.new do |s|
s.author = { 'raginmari' => '[email protected]' }
s.source = { :git => 'https://github.com/raginmari/RAGTextField.git', :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
s.swift_version = '4.2'
s.swift_version = '5.0'
s.source_files = 'RAGTextField/Classes/**/*'
end
3 changes: 3 additions & 0 deletions RAGTextField/Classes/PlaceholderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ final class PlaceholderView: UIView {
view.layer.anchorPoint = CGPoint(x: 1.0, y: 0.5)
case (.center, _):
view.layer.anchorPoint = CGPoint(x: 0.5, y: 0.5)
@unknown default:
// Use left-to-right value
view.layer.anchorPoint = CGPoint(x: 0.0, y: 0.5)
}

view.frame = bounds
Expand Down
13 changes: 13 additions & 0 deletions RAGTextField/Classes/RAGTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ open class RAGTextField: UITextField {
return !isEditing || !hasText
case .never:
return false
@unknown default:
return false
}
}

Expand All @@ -507,6 +509,8 @@ open class RAGTextField: UITextField {
return !isEditing && hasText
case .never:
return false
@unknown default:
return false
}
}

Expand Down Expand Up @@ -974,6 +978,9 @@ open class RAGTextField: UITextField {
constraint = placeholderContainerView.trailingAnchor.constraint(equalTo: placeholderView.trailingAnchor)
case (.center, _):
constraint = placeholderView.centerXAnchor.constraint(equalTo: placeholderContainerView.centerXAnchor)
@unknown default:
// Use left-to-right constraint
constraint = placeholderView.leadingAnchor.constraint(equalTo: placeholderContainerView.leadingAnchor)
}

constraint.constant = normalHorizontalPlaceholderConstraintConstant(for: textAlignment)
Expand All @@ -998,6 +1005,9 @@ open class RAGTextField: UITextField {
return computeRightInsetToText()
case (.center, _):
return 0.0
@unknown default:
// Use left-to-right value
return computeLeftInsetToText()
}
}

Expand All @@ -1017,6 +1027,9 @@ open class RAGTextField: UITextField {
constraint = placeholderContainerView.trailingAnchor.constraint(equalTo: placeholderView.trailingAnchor)
case (.center, _):
constraint = placeholderView.centerXAnchor.constraint(equalTo: placeholderContainerView.centerXAnchor)
@unknown default:
// Use left-to-right constraint
constraint = placeholderView.leadingAnchor.constraint(equalTo: placeholderContainerView.leadingAnchor)
}

constraint.constant = scaledHorizontalPlaceholderConstraintConstant(for: textAlignment)
Expand Down

0 comments on commit 4575ed5

Please sign in to comment.