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

update swift4.2 #25

Open
wants to merge 2 commits 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
19 changes: 13 additions & 6 deletions ACTabScrollView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
295D89162165AAA700487C3B /* Demo.xib in Resources */ = {isa = PBXBuildFile; fileRef = 295D89152165AAA700487C3B /* Demo.xib */; };
530068331CEDDE7600A80F09 /* ContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 530068321CEDDE7600A80F09 /* ContentViewController.swift */; };
530068351CF0512F00A80F09 /* MockData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 530068341CF0512F00A80F09 /* MockData.swift */; };
53887DDB1CE8AD3D001E6FD3 /* DemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53887DDA1CE8AD3D001E6FD3 /* DemoViewController.swift */; };
Expand All @@ -31,6 +32,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
295D89152165AAA700487C3B /* Demo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Demo.xib; sourceTree = "<group>"; };
530068321CEDDE7600A80F09 /* ContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentViewController.swift; sourceTree = "<group>"; };
530068341CF0512F00A80F09 /* MockData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockData.swift; sourceTree = "<group>"; };
53887DDA1CE8AD3D001E6FD3 /* DemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -94,6 +96,7 @@
530068321CEDDE7600A80F09 /* ContentViewController.swift */,
53887DDA1CE8AD3D001E6FD3 /* DemoViewController.swift */,
6DB0CD291B8462B90069AE39 /* Main.storyboard */,
295D89152165AAA700487C3B /* Demo.xib */,
6DB0CD2C1B8462B90069AE39 /* Images.xcassets */,
6DB0CD2E1B8462B90069AE39 /* LaunchScreen.xib */,
6DB0CD231B8462B90069AE39 /* Supporting Files */,
Expand Down Expand Up @@ -181,12 +184,11 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0910;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = AzureChen;
TargetAttributes = {
6DB0CD1F1B8462B90069AE39 = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = AFJ2WGE2QB;
LastSwiftMigration = 0800;
};
6DB0CD341B8462B90069AE39 = {
Expand Down Expand Up @@ -221,6 +223,7 @@
buildActionMask = 2147483647;
files = (
6DB0CD2B1B8462B90069AE39 /* Main.storyboard in Resources */,
295D89162165AAA700487C3B /* Demo.xib in Resources */,
6DB0CD301B8462B90069AE39 /* LaunchScreen.xib in Resources */,
6DB0CD2D1B8462B90069AE39 /* Images.xcassets in Resources */,
);
Expand Down Expand Up @@ -300,12 +303,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -354,12 +359,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -395,14 +402,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = AFJ2WGE2QB;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ACTabScrollView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.azurechen.ACTabScrollView;
PRODUCT_NAME = ACTabScrollView;
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -412,14 +419,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = AFJ2WGE2QB;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = ACTabScrollView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.azurechen.ACTabScrollView;
PRODUCT_NAME = ACTabScrollView;
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
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>
2 changes: 1 addition & 1 deletion ACTabScrollView/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
42 changes: 4 additions & 38 deletions ACTabScrollView/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="VUE-f8-3s2">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="VUE-f8-3s2">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -51,13 +50,13 @@
</variation>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nbr-9R-GKx">
<rect key="frame" x="111" y="16" width="249" height="43"/>
<rect key="frame" x="111" y="16" width="249" height="43.5"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="17"/>
<color key="textColor" red="0.29019607843137252" green="0.29803921568627451" blue="0.31764705882352939" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="rtq-l3-kbv">
<rect key="frame" x="111" y="63" width="79" height="26"/>
<rect key="frame" x="111" y="63.5" width="79" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="category" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YZq-CT-JLB">
<rect key="frame" x="8" y="4" width="63" height="18"/>
Expand Down Expand Up @@ -197,38 +196,5 @@
</objects>
<point key="canvasLocation" x="-253" y="254"/>
</scene>
<!--Demo View Controller-->
<scene sceneID="9CW-yv-7Bo">
<objects>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="S0q-1n-yhF" customClass="DemoViewController" customModule="ACTabScrollView" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="OVf-3x-AtA"/>
<viewControllerLayoutGuide type="bottom" id="14B-mi-1zy"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="hd5-6J-MDH">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FTT-i0-ccm" customClass="ACTabScrollView" customModule="ACTabScrollView" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="14B-mi-1zy" firstAttribute="top" secondItem="FTT-i0-ccm" secondAttribute="bottom" id="1af-ao-NAb"/>
<constraint firstItem="FTT-i0-ccm" firstAttribute="leading" secondItem="hd5-6J-MDH" secondAttribute="leading" id="5qU-Dp-HFu"/>
<constraint firstItem="FTT-i0-ccm" firstAttribute="top" secondItem="hd5-6J-MDH" secondAttribute="top" id="7zJ-lL-bY8"/>
<constraint firstAttribute="trailing" secondItem="FTT-i0-ccm" secondAttribute="trailing" id="OMz-vX-SfQ"/>
</constraints>
</view>
<connections>
<outlet property="tabScrollView" destination="FTT-i0-ccm" id="rzh-8z-zK3"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="feR-MX-GuE" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-253" y="-504"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion ACTabScrollView/ContentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ContentViewController: UIViewController, UITableViewDelegate, UITableViewD
override func viewDidLoad() {
super.viewDidLoad()

tableView.rowHeight = UITableViewAutomaticDimension
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 44
tableView.delegate = self
tableView.dataSource = self
Expand Down
44 changes: 44 additions & 0 deletions ACTabScrollView/Demo.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<viewController automaticallyAdjustsScrollViewInsets="NO" id="R7D-iA-2cK" customClass="DemoViewController" customModule="ACTabScrollView" customModuleProvider="target">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="twm-cL-pwH"/>
<viewControllerLayoutGuide type="bottom" id="AKa-u5-A4T"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Oec-dH-8gH">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U7M-Hu-21d" customClass="ACTabScrollView" customModule="ACTabScrollView" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="U7M-Hu-21d" firstAttribute="top" secondItem="Oec-dH-8gH" secondAttribute="top" id="G9l-M7-t69"/>
<constraint firstAttribute="trailing" secondItem="U7M-Hu-21d" secondAttribute="trailing" id="NqK-9V-waZ"/>
<constraint firstItem="AKa-u5-A4T" firstAttribute="top" secondItem="U7M-Hu-21d" secondAttribute="bottom" id="eAR-lQ-5lX"/>
<constraint firstItem="U7M-Hu-21d" firstAttribute="leading" secondItem="Oec-dH-8gH" secondAttribute="leading" id="jmh-pz-buO"/>
</constraints>
<viewLayoutGuide key="safeArea" id="DCr-iW-Veu"/>
</view>
<connections>
<outlet property="tabScrollView" destination="U7M-Hu-21d" id="H9N-M3-8SK"/>
</connections>
<point key="canvasLocation" x="-253" y="-504"/>
</viewController>
</objects>
</document>
10 changes: 7 additions & 3 deletions ACTabScrollView/NewsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class NewsViewController: UIViewController, ACTabScrollViewDelegate, ACTabScroll

var contentViews: [UIView] = []

override var preferredStatusBarStyle : UIStatusBarStyle {
return .lightContent
}

override func viewDidLoad() {
super.viewDidLoad()

Expand All @@ -36,7 +40,7 @@ class NewsViewController: UIViewController, ACTabScrollViewDelegate, ACTabScroll
let vc = storyboard.instantiateViewController(withIdentifier: "ContentViewController") as! ContentViewController
vc.category = category

addChildViewController(vc) // don't forget, it's very important
addChild(vc) // don't forget, it's very important
contentViews.append(vc.view)
}

Expand All @@ -45,11 +49,11 @@ class NewsViewController: UIViewController, ACTabScrollViewDelegate, ACTabScroll
navigationBar.isTranslucent = false
navigationBar.tintColor = UIColor.white
navigationBar.barTintColor = UIColor(red: 38.0 / 255, green: 191.0 / 255, blue: 140.0 / 255, alpha: 1)
navigationBar.titleTextAttributes = NSDictionary(object: UIColor.white, forKey: NSAttributedStringKey.foregroundColor as NSCopying) as? [NSAttributedStringKey : AnyObject]
navigationBar.titleTextAttributes = NSDictionary(object: UIColor.white, forKey: NSAttributedString.Key.foregroundColor as NSCopying) as? [NSAttributedString.Key : AnyObject]
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
navigationBar.shadowImage = UIImage()
}
UIApplication.shared.statusBarStyle = UIStatusBarStyle.lightContent
setNeedsStatusBarAppearanceUpdate()
}

// MARK: ACTabScrollViewDelegate
Expand Down
2 changes: 1 addition & 1 deletion Sources/ACTabScrollView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ open class ACTabScrollView: UIView, UIScrollViewDelegate {

if let tab = self.cachedPageTabs[i] {
if (animated) {
UIView.animate(withDuration: 0.5, delay: 0, options: UIViewAnimationOptions.allowUserInteraction, animations: {
UIView.animate(withDuration: 0.5, delay: 0, options: UIView.AnimationOptions.allowUserInteraction, animations: {
tab.alpha = alpha
return
}, completion: nil)
Expand Down