Skip to content

Commit

Permalink
update to swift5
Browse files Browse the repository at this point in the history
  • Loading branch information
张智杰 committed Nov 12, 2020
1 parent 7d0632a commit 8f5be2b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 143 deletions.
8 changes: 4 additions & 4 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'ZJFlexibleLayout' do
#target 'ZJFlexibleLayout' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
#use_frameworks!

# Pods for ZJFlexibleLayout

end
#end

target 'ZJFlexibleLayoutDemo' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'ZJFlexibleLayout'
pod 'ZJFlexibleLayout', :path => './'
# Pods for ZJFlexibleLayoutDemo

end
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ PODS:
- ZJFlexibleLayout (1.0)

DEPENDENCIES:
- ZJFlexibleLayout
- ZJFlexibleLayout (from `./`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- ZJFlexibleLayout
EXTERNAL SOURCES:
ZJFlexibleLayout:
:path: "./"

SPEC CHECKSUMS:
ZJFlexibleLayout: 58094cc7c51113a356f3d80c3e3107af4ef47387

PODFILE CHECKSUM: 6405007a9fdd917f386c6e0d26335333e9256a16
PODFILE CHECKSUM: 3bde4c2155ece160a6a96481951b46cbd2b75df6

COCOAPODS: 1.5.3
COCOAPODS: 1.8.4
2 changes: 1 addition & 1 deletion Source/ZJFlexibleLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ open class ZJFlexibleLayout: UICollectionViewLayout {
let headerH = headerSize.height

//拼接header 的layoutAttributes
let headerAttributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, with: IndexPath(item: 0, section: section))
let headerAttributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, with: IndexPath(item: 0, section: section))
headerAttributes.frame = CGRect(x: headerX, y: currentSectionHeaderY, width: headerSize.width, height: headerSize.height)
layoutHeaderViewInfo.append(headerAttributes)

Expand Down
2 changes: 1 addition & 1 deletion ZJFlexibleLayout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "ZJFlexibleLayout"
s.version = "1.0"
s.version = "2.0"
s.summary = "An intuitive custom tool of making flexible layout including waterfall flow."

# This description is used to generate tags and improve search results.
Expand Down
15 changes: 6 additions & 9 deletions ZJFlexibleLayoutDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
B44671221DF9BE6200B576D0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B44671211DF9BE6200B576D0 /* ViewController.swift */; };
B44671271DF9BE6200B576D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B44671261DF9BE6200B576D0 /* Assets.xcassets */; };
B446712A1DF9BE6200B576D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B44671281DF9BE6200B576D0 /* LaunchScreen.storyboard */; };
B474D1FA20F5272800BCC95B /* SwiftColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = B474D1F920F5272800BCC95B /* SwiftColors.swift */; };
B49292EC1DF9C888000895B8 /* CustomCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B49292EB1DF9C888000895B8 /* CustomCell.swift */; };
B49292EE1DF9C968000895B8 /* CustomHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = B49292ED1DF9C968000895B8 /* CustomHeader.swift */; };
ECA625FF0557F35DB0CED4A5 /* Pods_ZJFlexibleLayoutDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4211532F740F28DBB21C5106 /* Pods_ZJFlexibleLayoutDemo.framework */; };
Expand Down Expand Up @@ -40,7 +39,6 @@
B44671261DF9BE6200B576D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
B44671291DF9BE6200B576D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
B446712B1DF9BE6200B576D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B474D1F920F5272800BCC95B /* SwiftColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SwiftColors.swift; path = ../../../Documents/Personal_Projects/ZJFlexibleLayout/ZJFlexibleLayoutDemo/SwiftColors.swift; sourceTree = "<group>"; };
B49292EB1DF9C888000895B8 /* CustomCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomCell.swift; sourceTree = "<group>"; };
B49292ED1DF9C968000895B8 /* CustomHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomHeader.swift; sourceTree = "<group>"; };
C096844B2354EF326019BD1A /* Pods_ZJFlexibleLayout.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ZJFlexibleLayout.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -105,7 +103,6 @@
B44671211DF9BE6200B576D0 /* ViewController.swift */,
B49292EB1DF9C888000895B8 /* CustomCell.swift */,
B49292ED1DF9C968000895B8 /* CustomHeader.swift */,
B474D1F920F5272800BCC95B /* SwiftColors.swift */,
B44671261DF9BE6200B576D0 /* Assets.xcassets */,
B44671281DF9BE6200B576D0 /* LaunchScreen.storyboard */,
B446712B1DF9BE6200B576D0 /* Info.plist */,
Expand Down Expand Up @@ -149,7 +146,7 @@
B446711B1DF9BE6200B576D0 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = Z4H85W66CY;
LastSwiftMigration = 0900;
LastSwiftMigration = 1210;
ProvisioningStyle = Automatic;
};
};
Expand All @@ -159,6 +156,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -191,7 +189,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ZJFlexibleLayoutDemo/Pods-ZJFlexibleLayoutDemo-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-ZJFlexibleLayoutDemo/Pods-ZJFlexibleLayoutDemo-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ZJFlexibleLayout/ZJFlexibleLayout.framework",
);
name = "[CP] Embed Pods Frameworks";
Expand All @@ -200,7 +198,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ZJFlexibleLayoutDemo/Pods-ZJFlexibleLayoutDemo-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ZJFlexibleLayoutDemo/Pods-ZJFlexibleLayoutDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
33EC3ABAADAA72FE57AF6FD9 /* [CP] Check Pods Manifest.lock */ = {
Expand Down Expand Up @@ -232,7 +230,6 @@
B49292EC1DF9C888000895B8 /* CustomCell.swift in Sources */,
B44671201DF9BE6200B576D0 /* AppDelegate.swift in Sources */,
B49292EE1DF9C968000895B8 /* CustomHeader.swift in Sources */,
B474D1FA20F5272800BCC95B /* SwiftColors.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -353,7 +350,7 @@
PRODUCT_BUNDLE_IDENTIFIER = cn.ZhijieZhang.ZJFlexibleLayoutDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -369,7 +366,7 @@
PRODUCT_BUNDLE_IDENTIFIER = cn.ZhijieZhang.ZJFlexibleLayoutDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion ZJFlexibleLayoutDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = UINavigationController(rootViewController: ViewController())
window?.makeKeyAndVisible()
Expand Down
114 changes: 0 additions & 114 deletions ZJFlexibleLayoutDemo/SwiftColors.swift

This file was deleted.

14 changes: 7 additions & 7 deletions ZJFlexibleLayoutDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ViewController: UIViewController {
//设置headerView
let headerView = UILabel(frame: CGRect(x: 0, y: 10, width: kScreenWidth, height: 200))
headerView.textAlignment = .center
headerView.attributedText = NSAttributedString(string: "我是CollectionHeaderView", attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 18), NSAttributedStringKey.foregroundColor: UIColor.white])
headerView.attributedText = NSAttributedString(string: "我是CollectionHeaderView", attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 18), NSAttributedString.Key.foregroundColor: UIColor.white])
headerView.backgroundColor = systemGreenColor
layout.collectionHeaderView = headerView

Expand All @@ -48,7 +48,7 @@ class ViewController: UIViewController {
collectionView.backgroundColor = .white
collectionView.dataSource = self
collectionView.register(CustomCell.self, forCellWithReuseIdentifier: "cell")
collectionView.register(CustomHeader.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "header")
collectionView.register(CustomHeader.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
}
}

Expand Down Expand Up @@ -96,17 +96,17 @@ extension ViewController: UICollectionViewDataSource{
}

func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "header", for: indexPath) as! CustomHeader
let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header", for: indexPath) as! CustomHeader
header.label.text = "我是第\(indexPath.section)个sectionHeader"
header.backgroundColor = .brown
return header
}
}

let systemBlueColor = UIColor(hex: 0x428bca) ?? UIColor.blue
let systemRedColor = UIColor(hex: 0xd9534f) ?? UIColor.red
let systemGreenColor = UIColor(hex: 0x5cb85c) ?? UIColor.green
let systemYelloColor = UIColor(hex: 0xf0ad4e) ?? UIColor.yellow
let systemBlueColor = UIColor.blue
let systemRedColor = UIColor.red
let systemGreenColor = UIColor.green
let systemYelloColor = UIColor.yellow
let colors = [systemBlueColor, systemRedColor, systemGreenColor, systemYelloColor]
let kScreenBounds = UIScreen.main.bounds
let kScreenSize = kScreenBounds.size
Expand Down

0 comments on commit 8f5be2b

Please sign in to comment.