Skip to content
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
Binary file added .DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions KFImageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// KFImageView.swift
// SDCycleScrollView
//
// Created by york on 2025/6/26.
//

import UIKit

@objc
class KFImageView: UIImageView {

/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/

}

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

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
北上广深杭大量招人,各种研发岗位都在找,有意向者可以直接点击后面链接投递简历或者联系我 gsdios@126.com https://job.toutiao.com/s/eL91QMm,

### 支持pod导入
pod 'SDCycleScrollView','>= 1.82'
pod 'SDCycleScrollView', :git=> "https://github.com/QiuYeHong90/SDCycleScrollView", :tag => "1.8.3"

### 支持pod导 的方案swift Kingfisher 模式依赖,默认依赖
pod 'SDCycleScrollView', :subspecs => ["SwiftNOSD"], :git=> "https://github.com/QiuYeHong90/SDCycleScrollView", :tag => "1.8.3"

### 更改记录:

Expand Down
19 changes: 13 additions & 6 deletions SDCycleScrollView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@ s.license = "MIT"

s.author = { "GSD_iOS" => "gsdios@126.com" }

s.platform = :ios
s.platform = :ios, "8.0"

s.platform = :ios
s.ios.deployment_target = "11.0"

s.source = { :git => "https://github.com/gsdios/SDCycleScrollView.git", :tag => s.version}


s.source_files = "SDCycleScrollView/Lib/SDCycleScrollView/**/*.{h,m}"
s.requires_arc = true
s.default_subspec = "Core"
s.swift_versions = ['5.0']
s.subspec "Core" do |core|
core.source_files = "SDCycleScrollView/Lib/SDCycleScrollView/**/*.{h,m}"
core.dependency 'SDWebImage', '>= 5.0.0'
end
s.subspec "SwiftNOSD" do |core|
core.source_files = ["SDCycleScrollView/Lib/SDCycleScrollView/**/*.{h,m}","SDCycleScrollView/Lib/SDCycleScrollView/**/*.swift"]
core.dependency 'Kingfisher'
end


s.requires_arc = true


s.dependency 'SDWebImage', '>= 5.0.0'

end
14 changes: 10 additions & 4 deletions SDCycleScrollView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
5F55240E74603C429F5220D2 /* Pods-SDCycleScrollView.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDCycleScrollView.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SDCycleScrollView/Pods-SDCycleScrollView.debug.xcconfig"; sourceTree = "<group>"; };
6BAA27FB1EFEA798008693AB /* CustomCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomCollectionViewCell.h; sourceTree = "<group>"; };
6BAA27FC1EFEA798008693AB /* CustomCollectionViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomCollectionViewCell.m; sourceTree = "<group>"; };
980C9E1F2E0D460400B74484 /* SDCycleScrollView.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = SDCycleScrollView.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9900D16E1ABEB2490077A6CB /* SDCycleScrollView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SDCycleScrollView.app; sourceTree = BUILT_PRODUCTS_DIR; };
9900D1721ABEB2490077A6CB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9900D1731ABEB2490077A6CB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -181,6 +182,7 @@
9900D1711ABEB2490077A6CB /* Supporting Files */,
6BAA27FB1EFEA798008693AB /* CustomCollectionViewCell.h */,
6BAA27FC1EFEA798008693AB /* CustomCollectionViewCell.m */,
980C9E1F2E0D460400B74484 /* SDCycleScrollView.podspec */,
);
path = SDCycleScrollView;
sourceTree = "<group>";
Expand Down Expand Up @@ -316,6 +318,7 @@
TargetAttributes = {
9900D16D1ABEB2490077A6CB = {
CreatedOnToolsVersion = 6.1;
DevelopmentTeam = YQ2BBNYL5U;
ProvisioningStyle = Automatic;
};
9900D1861ABEB2490077A6CB = {
Expand All @@ -329,6 +332,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -528,9 +532,9 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = YQ2BBNYL5U;
INFOPLIST_FILE = SDCycleScrollView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -546,9 +550,9 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = YQ2BBNYL5U;
INFOPLIST_FILE = SDCycleScrollView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -569,6 +573,7 @@
"$(inherited)",
);
INFOPLIST_FILE = SDCycleScrollViewTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SDCycleScrollView.app/SDCycleScrollView";
Expand All @@ -584,6 +589,7 @@
"$(inherited)",
);
INFOPLIST_FILE = SDCycleScrollViewTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SDCycleScrollView.app/SDCycleScrollView";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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>SchemeUserState</key>
<dict>
<key>SDCycleScrollView.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.
Binary file added SDCycleScrollView/.DS_Store
Binary file not shown.
Binary file added SDCycleScrollView/Lib/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@ typedef enum {

/** 清除图片缓存(兼容旧版本方法) */
- (void)clearCache;

-(void)loadWithImageView: (UIImageView *)imageView url: (NSURL *)url;
@end
38 changes: 33 additions & 5 deletions SDCycleScrollView/Lib/SDCycleScrollView/SDCycleScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@
#import "SDCollectionViewCell.h"
#import "UIView+SDExtension.h"
#import "TAPageControl.h"

#if __has_include(<SDWebImage/SDWebImage.h>)
#import "SDWebImageManager.h"
#import "UIImageView+WebCache.h"
#else
#import <SDCycleScrollView/SDCycleScrollView-Swift.h>
#endif


#define kCycleScrollViewInitialPageControlDotSize CGSizeMake(10, 10)

Expand Down Expand Up @@ -65,13 +71,23 @@ - (instancetype)initWithFrame:(CGRect)frame
return self;
}

- (void)awakeFromNib
- (instancetype)initWithCoder:(NSCoder *)coder
{
[super awakeFromNib];
[self initialization];
[self setupMainView];
self = [super initWithCoder:coder];
if (self) {
[self initialization];
[self setupMainView];
}
return self;
}

//- (void)awakeFromNib
//{
// [super awakeFromNib];
// [self initialization];
// [self setupMainView];
//}

- (void)initialization
{
_pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
Expand Down Expand Up @@ -477,7 +493,11 @@ - (void)clearCache

+ (void)clearImagesCache
{

#if __has_include(<SDWebImage/SDWebImage.h>)
[[[SDWebImageManager sharedManager] imageCache] clearWithCacheType:SDImageCacheTypeDisk completion:nil];
#else
#endif
}

#pragma mark - life circles
Expand Down Expand Up @@ -593,7 +613,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell

if (!self.onlyDisplayText && [imagePath isKindOfClass:[NSString class]]) {
if ([imagePath hasPrefix:@"http"]) {
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:imagePath] placeholderImage:self.placeholderImage];
[self loadWithImageView:cell.imageView url:[NSURL URLWithString:imagePath]];
} else {
UIImage *image = [UIImage imageNamed:imagePath];
if (!image) {
Expand Down Expand Up @@ -624,6 +644,14 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
return cell;
}

-(void)loadWithImageView: (UIImageView *)imageView url: (NSURL *)url {
#if __has_include(<SDWebImage/SDWebImage.h>)
[imageView sd_setImageWithURL:url placeholderImage:self.placeholderImage];
#else
[imageView setYQLoadImage:url placeholderImage:self.placeholderImage];
#endif
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didSelectItemAtIndex:)]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// SDSwiftCycleScrollView.swift
// SDCycleScrollView
//
// Created by york on 2025/6/26.
//

import UIKit

public class SDSwiftCycleScrollView: SDCycleScrollView {

public override func load(with imageView: UIImageView!, url: URL!) {
imageView.setYQLoadImage(url, placeholderImage: self.placeholderImage)
}

}
15 changes: 15 additions & 0 deletions SDCycleScrollView/Lib/SDCycleScrollView/UIImageView+KF.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// UIImageView+KF.swift
// SDCycleScrollView
//
// Created by york on 2025/6/26.
//

import UIKit
import Kingfisher

public extension UIImageView {
@objc func setYQLoadImage(_ url: URL?, placeholderImage: UIImage?) {
self.kf.setImage(with: url,placeholder: placeholderImage)
}
}
Binary file added SwiftDemo/.DS_Store
Binary file not shown.
Binary file added SwiftDemo/SDCycleSrollViewDemo/.DS_Store
Binary file not shown.
45 changes: 45 additions & 0 deletions SwiftDemo/SDCycleSrollViewDemo/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'SDCycleSrollViewDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod "SDCycleScrollView", :subspecs => ["SwiftNOSD"], :path => "../../"
# Pods for SDCycleSrollViewDemo
end



post_install do |installer|

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
end


end

installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end


bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
framework_path = File.join(Dir.pwd, framework_relative_path)
command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
puts "Stripping bitcode: #{command}"
system(command)
end

framework_paths = [

]

framework_paths.each do |framework_relative_path|
strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
end
end
23 changes: 23 additions & 0 deletions SwiftDemo/SDCycleSrollViewDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PODS:
- Kingfisher (8.3.3)
- SDCycleScrollView/SwiftNOSD (1.82):
- Kingfisher

DEPENDENCIES:
- SDCycleScrollView/SwiftNOSD (from `../../`)

SPEC REPOS:
trunk:
- Kingfisher

EXTERNAL SOURCES:
SDCycleScrollView:
:path: "../../"

SPEC CHECKSUMS:
Kingfisher: ff82cb91d9266ddb56cbb2f72d32c26f00d3e5be
SDCycleScrollView: 357d9df5ad77352f6e36b9c94ab8e34f0eba1513

PODFILE CHECKSUM: 43fcfd2a94ca076de4190913c33da62fffa2a25f

COCOAPODS: 1.16.2
22 changes: 22 additions & 0 deletions SwiftDemo/SDCycleSrollViewDemo/Pods/Kingfisher/LICENSE

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

Loading