├── .gitignore ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcuserdata │ │ └── jiaxin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── Example.xcworkspace │ └── contents.xcworkspacedata └── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift ├── JXExcel.podspec ├── JXExcel.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── jiaxin.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── JXExcel ├── Info.plist └── JXExcel.h ├── LICENSE ├── README.md └── Sources └── ExcelView.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 19DAB531232A2F7A0086CAC9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19DAB530232A2F7A0086CAC9 /* AppDelegate.swift */; }; 11 | 19DAB533232A2F7A0086CAC9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19DAB532232A2F7A0086CAC9 /* ViewController.swift */; }; 12 | 19DAB536232A2F7A0086CAC9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 19DAB534232A2F7A0086CAC9 /* Main.storyboard */; }; 13 | 19DAB538232A2F7E0086CAC9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 19DAB537232A2F7E0086CAC9 /* Assets.xcassets */; }; 14 | 19DAB53B232A2F7E0086CAC9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 19DAB539232A2F7E0086CAC9 /* LaunchScreen.storyboard */; }; 15 | 19DAB548232A30080086CAC9 /* JXExcel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 19DAB547232A30080086CAC9 /* JXExcel.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 19DAB52D232A2F7A0086CAC9 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 19DAB530232A2F7A0086CAC9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 19DAB532232A2F7A0086CAC9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 19DAB535232A2F7A0086CAC9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 19DAB537232A2F7E0086CAC9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 19DAB53A232A2F7E0086CAC9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 19DAB53C232A2F7E0086CAC9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 19DAB547232A30080086CAC9 /* JXExcel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JXExcel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 19DAB52A232A2F7A0086CAC9 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | 19DAB548232A30080086CAC9 /* JXExcel.framework in Frameworks */, 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 19DAB524232A2F7A0086CAC9 = { 42 | isa = PBXGroup; 43 | children = ( 44 | 19DAB52F232A2F7A0086CAC9 /* Example */, 45 | 19DAB52E232A2F7A0086CAC9 /* Products */, 46 | 19DAB546232A30080086CAC9 /* Frameworks */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 19DAB52E232A2F7A0086CAC9 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 19DAB52D232A2F7A0086CAC9 /* Example.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 19DAB52F232A2F7A0086CAC9 /* Example */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 19DAB530232A2F7A0086CAC9 /* AppDelegate.swift */, 62 | 19DAB532232A2F7A0086CAC9 /* ViewController.swift */, 63 | 19DAB534232A2F7A0086CAC9 /* Main.storyboard */, 64 | 19DAB537232A2F7E0086CAC9 /* Assets.xcassets */, 65 | 19DAB539232A2F7E0086CAC9 /* LaunchScreen.storyboard */, 66 | 19DAB53C232A2F7E0086CAC9 /* Info.plist */, 67 | ); 68 | path = Example; 69 | sourceTree = ""; 70 | }; 71 | 19DAB546232A30080086CAC9 /* Frameworks */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 19DAB547232A30080086CAC9 /* JXExcel.framework */, 75 | ); 76 | name = Frameworks; 77 | sourceTree = ""; 78 | }; 79 | /* End PBXGroup section */ 80 | 81 | /* Begin PBXNativeTarget section */ 82 | 19DAB52C232A2F7A0086CAC9 /* Example */ = { 83 | isa = PBXNativeTarget; 84 | buildConfigurationList = 19DAB53F232A2F7E0086CAC9 /* Build configuration list for PBXNativeTarget "Example" */; 85 | buildPhases = ( 86 | 19DAB529232A2F7A0086CAC9 /* Sources */, 87 | 19DAB52A232A2F7A0086CAC9 /* Frameworks */, 88 | 19DAB52B232A2F7A0086CAC9 /* Resources */, 89 | ); 90 | buildRules = ( 91 | ); 92 | dependencies = ( 93 | ); 94 | name = Example; 95 | productName = Example; 96 | productReference = 19DAB52D232A2F7A0086CAC9 /* Example.app */; 97 | productType = "com.apple.product-type.application"; 98 | }; 99 | /* End PBXNativeTarget section */ 100 | 101 | /* Begin PBXProject section */ 102 | 19DAB525232A2F7A0086CAC9 /* Project object */ = { 103 | isa = PBXProject; 104 | attributes = { 105 | LastSwiftUpdateCheck = 1020; 106 | LastUpgradeCheck = 1020; 107 | ORGANIZATIONNAME = jiaxin; 108 | TargetAttributes = { 109 | 19DAB52C232A2F7A0086CAC9 = { 110 | CreatedOnToolsVersion = 10.2.1; 111 | }; 112 | }; 113 | }; 114 | buildConfigurationList = 19DAB528232A2F7A0086CAC9 /* Build configuration list for PBXProject "Example" */; 115 | compatibilityVersion = "Xcode 9.3"; 116 | developmentRegion = en; 117 | hasScannedForEncodings = 0; 118 | knownRegions = ( 119 | en, 120 | Base, 121 | ); 122 | mainGroup = 19DAB524232A2F7A0086CAC9; 123 | productRefGroup = 19DAB52E232A2F7A0086CAC9 /* Products */; 124 | projectDirPath = ""; 125 | projectRoot = ""; 126 | targets = ( 127 | 19DAB52C232A2F7A0086CAC9 /* Example */, 128 | ); 129 | }; 130 | /* End PBXProject section */ 131 | 132 | /* Begin PBXResourcesBuildPhase section */ 133 | 19DAB52B232A2F7A0086CAC9 /* Resources */ = { 134 | isa = PBXResourcesBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | 19DAB53B232A2F7E0086CAC9 /* LaunchScreen.storyboard in Resources */, 138 | 19DAB538232A2F7E0086CAC9 /* Assets.xcassets in Resources */, 139 | 19DAB536232A2F7A0086CAC9 /* Main.storyboard in Resources */, 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXResourcesBuildPhase section */ 144 | 145 | /* Begin PBXSourcesBuildPhase section */ 146 | 19DAB529232A2F7A0086CAC9 /* Sources */ = { 147 | isa = PBXSourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | 19DAB533232A2F7A0086CAC9 /* ViewController.swift in Sources */, 151 | 19DAB531232A2F7A0086CAC9 /* AppDelegate.swift in Sources */, 152 | ); 153 | runOnlyForDeploymentPostprocessing = 0; 154 | }; 155 | /* End PBXSourcesBuildPhase section */ 156 | 157 | /* Begin PBXVariantGroup section */ 158 | 19DAB534232A2F7A0086CAC9 /* Main.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | 19DAB535232A2F7A0086CAC9 /* Base */, 162 | ); 163 | name = Main.storyboard; 164 | sourceTree = ""; 165 | }; 166 | 19DAB539232A2F7E0086CAC9 /* LaunchScreen.storyboard */ = { 167 | isa = PBXVariantGroup; 168 | children = ( 169 | 19DAB53A232A2F7E0086CAC9 /* Base */, 170 | ); 171 | name = LaunchScreen.storyboard; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXVariantGroup section */ 175 | 176 | /* Begin XCBuildConfiguration section */ 177 | 19DAB53D232A2F7E0086CAC9 /* Debug */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_ANALYZER_NONNULL = YES; 182 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 183 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 184 | CLANG_CXX_LIBRARY = "libc++"; 185 | CLANG_ENABLE_MODULES = YES; 186 | CLANG_ENABLE_OBJC_ARC = YES; 187 | CLANG_ENABLE_OBJC_WEAK = YES; 188 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 189 | CLANG_WARN_BOOL_CONVERSION = YES; 190 | CLANG_WARN_COMMA = YES; 191 | CLANG_WARN_CONSTANT_CONVERSION = YES; 192 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 193 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 194 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 195 | CLANG_WARN_EMPTY_BODY = YES; 196 | CLANG_WARN_ENUM_CONVERSION = YES; 197 | CLANG_WARN_INFINITE_RECURSION = YES; 198 | CLANG_WARN_INT_CONVERSION = YES; 199 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 200 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 201 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 202 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 203 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 204 | CLANG_WARN_STRICT_PROTOTYPES = YES; 205 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 206 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | CODE_SIGN_IDENTITY = "iPhone Developer"; 210 | COPY_PHASE_STRIP = NO; 211 | DEBUG_INFORMATION_FORMAT = dwarf; 212 | ENABLE_STRICT_OBJC_MSGSEND = YES; 213 | ENABLE_TESTABILITY = YES; 214 | GCC_C_LANGUAGE_STANDARD = gnu11; 215 | GCC_DYNAMIC_NO_PIC = NO; 216 | GCC_NO_COMMON_BLOCKS = YES; 217 | GCC_OPTIMIZATION_LEVEL = 0; 218 | GCC_PREPROCESSOR_DEFINITIONS = ( 219 | "DEBUG=1", 220 | "$(inherited)", 221 | ); 222 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 223 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 224 | GCC_WARN_UNDECLARED_SELECTOR = YES; 225 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 226 | GCC_WARN_UNUSED_FUNCTION = YES; 227 | GCC_WARN_UNUSED_VARIABLE = YES; 228 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 229 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 230 | MTL_FAST_MATH = YES; 231 | ONLY_ACTIVE_ARCH = YES; 232 | SDKROOT = iphoneos; 233 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 234 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 235 | }; 236 | name = Debug; 237 | }; 238 | 19DAB53E232A2F7E0086CAC9 /* Release */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_ENABLE_OBJC_WEAK = YES; 249 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_COMMA = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 254 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 255 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 256 | CLANG_WARN_EMPTY_BODY = YES; 257 | CLANG_WARN_ENUM_CONVERSION = YES; 258 | CLANG_WARN_INFINITE_RECURSION = YES; 259 | CLANG_WARN_INT_CONVERSION = YES; 260 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 261 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 262 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | CODE_SIGN_IDENTITY = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 273 | ENABLE_NS_ASSERTIONS = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu11; 276 | GCC_NO_COMMON_BLOCKS = YES; 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 284 | MTL_ENABLE_DEBUG_INFO = NO; 285 | MTL_FAST_MATH = YES; 286 | SDKROOT = iphoneos; 287 | SWIFT_COMPILATION_MODE = wholemodule; 288 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Release; 292 | }; 293 | 19DAB540232A2F7E0086CAC9 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 297 | CODE_SIGN_STYLE = Manual; 298 | DEVELOPMENT_TEAM = ""; 299 | INFOPLIST_FILE = Example/Info.plist; 300 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 301 | LD_RUNPATH_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "@executable_path/Frameworks", 304 | ); 305 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.Example; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | PROVISIONING_PROFILE_SPECIFIER = ""; 308 | SWIFT_VERSION = 5.0; 309 | TARGETED_DEVICE_FAMILY = "1,2"; 310 | }; 311 | name = Debug; 312 | }; 313 | 19DAB541232A2F7E0086CAC9 /* Release */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CODE_SIGN_STYLE = Manual; 318 | DEVELOPMENT_TEAM = ""; 319 | INFOPLIST_FILE = Example/Info.plist; 320 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 321 | LD_RUNPATH_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "@executable_path/Frameworks", 324 | ); 325 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.Example; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | PROVISIONING_PROFILE_SPECIFIER = ""; 328 | SWIFT_VERSION = 5.0; 329 | TARGETED_DEVICE_FAMILY = "1,2"; 330 | }; 331 | name = Release; 332 | }; 333 | /* End XCBuildConfiguration section */ 334 | 335 | /* Begin XCConfigurationList section */ 336 | 19DAB528232A2F7A0086CAC9 /* Build configuration list for PBXProject "Example" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | 19DAB53D232A2F7E0086CAC9 /* Debug */, 340 | 19DAB53E232A2F7E0086CAC9 /* Release */, 341 | ); 342 | defaultConfigurationIsVisible = 0; 343 | defaultConfigurationName = Release; 344 | }; 345 | 19DAB53F232A2F7E0086CAC9 /* Build configuration list for PBXNativeTarget "Example" */ = { 346 | isa = XCConfigurationList; 347 | buildConfigurations = ( 348 | 19DAB540232A2F7E0086CAC9 /* Debug */, 349 | 19DAB541232A2F7E0086CAC9 /* Release */, 350 | ); 351 | defaultConfigurationIsVisible = 0; 352 | defaultConfigurationName = Release; 353 | }; 354 | /* End XCConfigurationList section */ 355 | }; 356 | rootObject = 19DAB525232A2F7A0086CAC9 /* Project object */; 357 | } 358 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/xcuserdata/jiaxin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Example.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by jiaxin on 2019/9/12. 6 | // Copyright © 2019 jiaxin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by jiaxin on 2019/9/12. 6 | // Copyright © 2019 jiaxin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import JXExcel 11 | 12 | class ViewController: UIViewController { 13 | var excel: ExcelView! 14 | var dataSource = [[String]]() 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | navigationController?.navigationBar.isTranslucent = false 20 | 21 | for row in 0..<50 { 22 | var rowData = [String]() 23 | for column in 0..<10 { 24 | rowData.append("r:\(row) c:\(column) grid") 25 | } 26 | dataSource.append(rowData) 27 | } 28 | 29 | excel = ExcelView(frame: CGRect.zero) 30 | excel.dataSource = self 31 | excel.delegate = self 32 | view.addSubview(excel) 33 | } 34 | 35 | override func viewDidLayoutSubviews() { 36 | super.viewDidLayoutSubviews() 37 | 38 | excel.frame = view.bounds 39 | } 40 | } 41 | 42 | extension ViewController: ExcelViewDataSource { 43 | func numberOfRows(in excelView: ExcelView) -> Int { 44 | return 50 45 | } 46 | 47 | func numberOfColumns(in excelView: ExcelView) -> Int { 48 | return 10 49 | } 50 | 51 | func excelView(_ excelView: ExcelView, columnNameAt column: Int) -> String { 52 | return "col:\(column)" 53 | } 54 | 55 | func excelView(_ excelView: ExcelView, rowDataAt row: Int) -> [String] { 56 | return dataSource[row] 57 | } 58 | 59 | func excelView(_ excelView: ExcelView, rowHeightAt row: Int) -> CGFloat { 60 | return 40 61 | } 62 | 63 | func excelView(_ excelView: ExcelView, columnWidthAt column: Int) -> CGFloat { 64 | return 120 65 | } 66 | 67 | func widthOfLeftHeader(in excelView: ExcelView) -> CGFloat { 68 | return 50 69 | } 70 | 71 | func heightOfTopHeader(in excelView: ExcelView) -> CGFloat { 72 | return 40 73 | } 74 | 75 | // func excelView(_ excelView: ExcelView, rowNameAt row: Int) -> String { 76 | // return "row:\(row)" 77 | // } 78 | } 79 | 80 | extension ViewController: ExcelViewDelegate { 81 | func excelView(_ excelView: ExcelView, didTapGridWith content: String) { 82 | print("didTapGridWith:\(content)") 83 | } 84 | 85 | func excelView(_ excelView: ExcelView, didTapColumnHeaderWith name: String) { 86 | print("didTapColumnHeaderWith:\(name)") 87 | } 88 | } 89 | 90 | -------------------------------------------------------------------------------- /JXExcel.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | s.name = "JXExcel" 4 | s.version = "0.0.3" 5 | s.summary = "一个轻量级的表视图" 6 | s.homepage = "https://github.com/pujiaxin33/JXExcel" 7 | s.license = "MIT" 8 | s.author = { "pujiaxin33" => "317437084@qq.com" } 9 | s.platform = :ios, "9.0" 10 | s.swift_version = "5.0" 11 | s.source = { :git => "https://github.com/pujiaxin33/JXExcel.git", :tag => "#{s.version}" } 12 | s.framework = "UIKit" 13 | s.source_files = "Sources", "Sources/*.{swift}" 14 | s.requires_arc = true 15 | 16 | end 17 | -------------------------------------------------------------------------------- /JXExcel.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 190B98FA23322C68001F9CA9 /* ExcelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190B98F923322C68001F9CA9 /* ExcelView.swift */; }; 11 | 19DAB51D232A2F550086CAC9 /* JXExcel.h in Headers */ = {isa = PBXBuildFile; fileRef = 19DAB51B232A2F550086CAC9 /* JXExcel.h */; settings = {ATTRIBUTES = (Public, ); }; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXFileReference section */ 15 | 190B98F923322C68001F9CA9 /* ExcelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExcelView.swift; sourceTree = ""; }; 16 | 19DAB518232A2F550086CAC9 /* JXExcel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JXExcel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | 19DAB51B232A2F550086CAC9 /* JXExcel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JXExcel.h; sourceTree = ""; }; 18 | 19DAB51C232A2F550086CAC9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 19 | /* End PBXFileReference section */ 20 | 21 | /* Begin PBXFrameworksBuildPhase section */ 22 | 19DAB515232A2F550086CAC9 /* Frameworks */ = { 23 | isa = PBXFrameworksBuildPhase; 24 | buildActionMask = 2147483647; 25 | files = ( 26 | ); 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXFrameworksBuildPhase section */ 30 | 31 | /* Begin PBXGroup section */ 32 | 190B98F823322C68001F9CA9 /* Sources */ = { 33 | isa = PBXGroup; 34 | children = ( 35 | 190B98F923322C68001F9CA9 /* ExcelView.swift */, 36 | ); 37 | path = Sources; 38 | sourceTree = SOURCE_ROOT; 39 | }; 40 | 19DAB50E232A2F550086CAC9 = { 41 | isa = PBXGroup; 42 | children = ( 43 | 19DAB51A232A2F550086CAC9 /* JXExcel */, 44 | 19DAB519232A2F550086CAC9 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | 19DAB519232A2F550086CAC9 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 19DAB518232A2F550086CAC9 /* JXExcel.framework */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | 19DAB51A232A2F550086CAC9 /* JXExcel */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 190B98F823322C68001F9CA9 /* Sources */, 60 | 19DAB51B232A2F550086CAC9 /* JXExcel.h */, 61 | 19DAB51C232A2F550086CAC9 /* Info.plist */, 62 | ); 63 | path = JXExcel; 64 | sourceTree = ""; 65 | }; 66 | /* End PBXGroup section */ 67 | 68 | /* Begin PBXHeadersBuildPhase section */ 69 | 19DAB513232A2F550086CAC9 /* Headers */ = { 70 | isa = PBXHeadersBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | 19DAB51D232A2F550086CAC9 /* JXExcel.h in Headers */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | /* End PBXHeadersBuildPhase section */ 78 | 79 | /* Begin PBXNativeTarget section */ 80 | 19DAB517232A2F550086CAC9 /* JXExcel */ = { 81 | isa = PBXNativeTarget; 82 | buildConfigurationList = 19DAB520232A2F550086CAC9 /* Build configuration list for PBXNativeTarget "JXExcel" */; 83 | buildPhases = ( 84 | 19DAB513232A2F550086CAC9 /* Headers */, 85 | 19DAB514232A2F550086CAC9 /* Sources */, 86 | 19DAB515232A2F550086CAC9 /* Frameworks */, 87 | 19DAB516232A2F550086CAC9 /* Resources */, 88 | ); 89 | buildRules = ( 90 | ); 91 | dependencies = ( 92 | ); 93 | name = JXExcel; 94 | productName = JXExcel; 95 | productReference = 19DAB518232A2F550086CAC9 /* JXExcel.framework */; 96 | productType = "com.apple.product-type.framework"; 97 | }; 98 | /* End PBXNativeTarget section */ 99 | 100 | /* Begin PBXProject section */ 101 | 19DAB50F232A2F550086CAC9 /* Project object */ = { 102 | isa = PBXProject; 103 | attributes = { 104 | LastUpgradeCheck = 1020; 105 | ORGANIZATIONNAME = jiaxin; 106 | TargetAttributes = { 107 | 19DAB517232A2F550086CAC9 = { 108 | CreatedOnToolsVersion = 10.2.1; 109 | LastSwiftMigration = 1020; 110 | }; 111 | }; 112 | }; 113 | buildConfigurationList = 19DAB512232A2F550086CAC9 /* Build configuration list for PBXProject "JXExcel" */; 114 | compatibilityVersion = "Xcode 9.3"; 115 | developmentRegion = en; 116 | hasScannedForEncodings = 0; 117 | knownRegions = ( 118 | en, 119 | ); 120 | mainGroup = 19DAB50E232A2F550086CAC9; 121 | productRefGroup = 19DAB519232A2F550086CAC9 /* Products */; 122 | projectDirPath = ""; 123 | projectRoot = ""; 124 | targets = ( 125 | 19DAB517232A2F550086CAC9 /* JXExcel */, 126 | ); 127 | }; 128 | /* End PBXProject section */ 129 | 130 | /* Begin PBXResourcesBuildPhase section */ 131 | 19DAB516232A2F550086CAC9 /* Resources */ = { 132 | isa = PBXResourcesBuildPhase; 133 | buildActionMask = 2147483647; 134 | files = ( 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | /* End PBXResourcesBuildPhase section */ 139 | 140 | /* Begin PBXSourcesBuildPhase section */ 141 | 19DAB514232A2F550086CAC9 /* Sources */ = { 142 | isa = PBXSourcesBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | 190B98FA23322C68001F9CA9 /* ExcelView.swift in Sources */, 146 | ); 147 | runOnlyForDeploymentPostprocessing = 0; 148 | }; 149 | /* End PBXSourcesBuildPhase section */ 150 | 151 | /* Begin XCBuildConfiguration section */ 152 | 19DAB51E232A2F550086CAC9 /* Debug */ = { 153 | isa = XCBuildConfiguration; 154 | buildSettings = { 155 | ALWAYS_SEARCH_USER_PATHS = NO; 156 | CLANG_ANALYZER_NONNULL = YES; 157 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 158 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 159 | CLANG_CXX_LIBRARY = "libc++"; 160 | CLANG_ENABLE_MODULES = YES; 161 | CLANG_ENABLE_OBJC_ARC = YES; 162 | CLANG_ENABLE_OBJC_WEAK = YES; 163 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 164 | CLANG_WARN_BOOL_CONVERSION = YES; 165 | CLANG_WARN_COMMA = YES; 166 | CLANG_WARN_CONSTANT_CONVERSION = YES; 167 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 168 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 169 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 170 | CLANG_WARN_EMPTY_BODY = YES; 171 | CLANG_WARN_ENUM_CONVERSION = YES; 172 | CLANG_WARN_INFINITE_RECURSION = YES; 173 | CLANG_WARN_INT_CONVERSION = YES; 174 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 175 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 176 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 177 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 178 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 179 | CLANG_WARN_STRICT_PROTOTYPES = YES; 180 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 181 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 182 | CLANG_WARN_UNREACHABLE_CODE = YES; 183 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 184 | CODE_SIGN_IDENTITY = "iPhone Developer"; 185 | COPY_PHASE_STRIP = NO; 186 | CURRENT_PROJECT_VERSION = 1; 187 | DEBUG_INFORMATION_FORMAT = dwarf; 188 | ENABLE_STRICT_OBJC_MSGSEND = YES; 189 | ENABLE_TESTABILITY = YES; 190 | GCC_C_LANGUAGE_STANDARD = gnu11; 191 | GCC_DYNAMIC_NO_PIC = NO; 192 | GCC_NO_COMMON_BLOCKS = YES; 193 | GCC_OPTIMIZATION_LEVEL = 0; 194 | GCC_PREPROCESSOR_DEFINITIONS = ( 195 | "DEBUG=1", 196 | "$(inherited)", 197 | ); 198 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 199 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 200 | GCC_WARN_UNDECLARED_SELECTOR = YES; 201 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 202 | GCC_WARN_UNUSED_FUNCTION = YES; 203 | GCC_WARN_UNUSED_VARIABLE = YES; 204 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 205 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 206 | MTL_FAST_MATH = YES; 207 | ONLY_ACTIVE_ARCH = YES; 208 | SDKROOT = iphoneos; 209 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 210 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 211 | VERSIONING_SYSTEM = "apple-generic"; 212 | VERSION_INFO_PREFIX = ""; 213 | }; 214 | name = Debug; 215 | }; 216 | 19DAB51F232A2F550086CAC9 /* Release */ = { 217 | isa = XCBuildConfiguration; 218 | buildSettings = { 219 | ALWAYS_SEARCH_USER_PATHS = NO; 220 | CLANG_ANALYZER_NONNULL = YES; 221 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 222 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 223 | CLANG_CXX_LIBRARY = "libc++"; 224 | CLANG_ENABLE_MODULES = YES; 225 | CLANG_ENABLE_OBJC_ARC = YES; 226 | CLANG_ENABLE_OBJC_WEAK = YES; 227 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 228 | CLANG_WARN_BOOL_CONVERSION = YES; 229 | CLANG_WARN_COMMA = YES; 230 | CLANG_WARN_CONSTANT_CONVERSION = YES; 231 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 232 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 233 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INFINITE_RECURSION = YES; 237 | CLANG_WARN_INT_CONVERSION = YES; 238 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 239 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 240 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 241 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 242 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 243 | CLANG_WARN_STRICT_PROTOTYPES = YES; 244 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 245 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 246 | CLANG_WARN_UNREACHABLE_CODE = YES; 247 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 248 | CODE_SIGN_IDENTITY = "iPhone Developer"; 249 | COPY_PHASE_STRIP = NO; 250 | CURRENT_PROJECT_VERSION = 1; 251 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 252 | ENABLE_NS_ASSERTIONS = NO; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | GCC_C_LANGUAGE_STANDARD = gnu11; 255 | GCC_NO_COMMON_BLOCKS = YES; 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 263 | MTL_ENABLE_DEBUG_INFO = NO; 264 | MTL_FAST_MATH = YES; 265 | SDKROOT = iphoneos; 266 | SWIFT_COMPILATION_MODE = wholemodule; 267 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 268 | VALIDATE_PRODUCT = YES; 269 | VERSIONING_SYSTEM = "apple-generic"; 270 | VERSION_INFO_PREFIX = ""; 271 | }; 272 | name = Release; 273 | }; 274 | 19DAB521232A2F550086CAC9 /* Debug */ = { 275 | isa = XCBuildConfiguration; 276 | buildSettings = { 277 | CLANG_ENABLE_MODULES = YES; 278 | CODE_SIGN_IDENTITY = ""; 279 | CODE_SIGN_STYLE = Automatic; 280 | DEFINES_MODULE = YES; 281 | DYLIB_COMPATIBILITY_VERSION = 1; 282 | DYLIB_CURRENT_VERSION = 1; 283 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 284 | INFOPLIST_FILE = JXExcel/Info.plist; 285 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 286 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 287 | LD_RUNPATH_SEARCH_PATHS = ( 288 | "$(inherited)", 289 | "@executable_path/Frameworks", 290 | "@loader_path/Frameworks", 291 | ); 292 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXExcel; 293 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 294 | SKIP_INSTALL = YES; 295 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 296 | SWIFT_VERSION = 5.0; 297 | TARGETED_DEVICE_FAMILY = "1,2"; 298 | }; 299 | name = Debug; 300 | }; 301 | 19DAB522232A2F550086CAC9 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | CLANG_ENABLE_MODULES = YES; 305 | CODE_SIGN_IDENTITY = ""; 306 | CODE_SIGN_STYLE = Automatic; 307 | DEFINES_MODULE = YES; 308 | DYLIB_COMPATIBILITY_VERSION = 1; 309 | DYLIB_CURRENT_VERSION = 1; 310 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 311 | INFOPLIST_FILE = JXExcel/Info.plist; 312 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 313 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 314 | LD_RUNPATH_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "@executable_path/Frameworks", 317 | "@loader_path/Frameworks", 318 | ); 319 | PRODUCT_BUNDLE_IDENTIFIER = jiaxin.JXExcel; 320 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 321 | SKIP_INSTALL = YES; 322 | SWIFT_VERSION = 5.0; 323 | TARGETED_DEVICE_FAMILY = "1,2"; 324 | }; 325 | name = Release; 326 | }; 327 | /* End XCBuildConfiguration section */ 328 | 329 | /* Begin XCConfigurationList section */ 330 | 19DAB512232A2F550086CAC9 /* Build configuration list for PBXProject "JXExcel" */ = { 331 | isa = XCConfigurationList; 332 | buildConfigurations = ( 333 | 19DAB51E232A2F550086CAC9 /* Debug */, 334 | 19DAB51F232A2F550086CAC9 /* Release */, 335 | ); 336 | defaultConfigurationIsVisible = 0; 337 | defaultConfigurationName = Release; 338 | }; 339 | 19DAB520232A2F550086CAC9 /* Build configuration list for PBXNativeTarget "JXExcel" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | 19DAB521232A2F550086CAC9 /* Debug */, 343 | 19DAB522232A2F550086CAC9 /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | /* End XCConfigurationList section */ 349 | }; 350 | rootObject = 19DAB50F232A2F550086CAC9 /* Project object */; 351 | } 352 | -------------------------------------------------------------------------------- /JXExcel.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JXExcel.xcodeproj/xcuserdata/jiaxin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JXExcel.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JXExcel/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /JXExcel/JXExcel.h: -------------------------------------------------------------------------------- 1 | // 2 | // JXExcel.h 3 | // JXExcel 4 | // 5 | // Created by jiaxin on 2019/9/12. 6 | // Copyright © 2019 jiaxin. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for JXExcel. 12 | FOUNDATION_EXPORT double JXExcelVersionNumber; 13 | 14 | //! Project version string for JXExcel. 15 | FOUNDATION_EXPORT const unsigned char JXExcelVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 暴走的鑫鑫 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JXExcel 2 | 3 | A lightweight table view,like Excel! 4 | 5 | # Preview 6 | 7 | ![](https://github.com/pujiaxin33/JXExampleImages/blob/master/JXExcel/JXExcel.gif) 8 | 9 | # Requirements 10 | 11 | - iOS 9.0+ 12 | - XCode 10.2.1+ 13 | - Swift 5.0+ 14 | 15 | # Install 16 | 17 | ## CocoaPods 18 | 19 | ```ruby 20 | Target '' do 21 |      Pod 'JXExcel' 22 | End 23 | ``` 24 | Execute `pod repo update` first, then execute `pod install` 25 | 26 | # Usage 27 | 28 | ## init `ExcelView` 29 | 30 | ```Swift 31 | excel = ExcelView(frame: CGRect.zero) 32 | excel.dataSource = self 33 | excel.delegate = self 34 | view.addSubview(excel) 35 | ``` 36 | 37 | ## implement `ExcelViewDataSource` 38 | ```Swift 39 | func numberOfRows(in excelView: ExcelView) -> Int { 40 | return 50 41 | } 42 | 43 | func numberOfColumns(in excelView: ExcelView) -> Int { 44 | return 10 45 | } 46 | 47 | func excelView(_ excelView: ExcelView, columnNameAt column: Int) -> String { 48 | return "col:\(column)" 49 | } 50 | 51 | func excelView(_ excelView: ExcelView, rowDataAt row: Int) -> [String] { 52 | return dataSource[row] 53 | } 54 | 55 | func excelView(_ excelView: ExcelView, rowHeightAt row: Int) -> CGFloat { 56 | return 40 57 | } 58 | 59 | func excelView(_ excelView: ExcelView, columnWidthAt column: Int) -> CGFloat { 60 | return 120 61 | } 62 | 63 | func widthOfLeftHeader(in excelView: ExcelView) -> CGFloat { 64 | return 50 65 | } 66 | 67 | func heightOfTopHeader(in excelView: ExcelView) -> CGFloat { 68 | return 40 69 | } 70 | ``` 71 | 72 | ## implement `ExcelViewDelegate` 73 | 74 | ```Swift 75 | func excelView(_ excelView: ExcelView, didTapGridWith content: String) { 76 | print("didTapGridWith:\(content)") 77 | } 78 | 79 | func excelView(_ excelView: ExcelView, didTapColumnHeaderWith name: String) { 80 | print("didTapColumnHeaderWith:\(name)") 81 | } 82 | ``` 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Sources/ExcelView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ExcelView.swift 3 | // JXExcel 4 | // 5 | // Created by jiaxin on 2019/9/12. 6 | // Copyright © 2019 jiaxin. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @objc public protocol ExcelViewDataSource: NSObjectProtocol { 12 | func numberOfRows(in excelView: ExcelView) -> Int 13 | func numberOfColumns(in excelView: ExcelView) -> Int 14 | func excelView(_ excelView: ExcelView, columnNameAt column: Int) -> String 15 | func excelView(_ excelView: ExcelView, rowDataAt row: Int) -> [String] 16 | func excelView(_ excelView: ExcelView, rowHeightAt row: Int) -> CGFloat 17 | func excelView(_ excelView: ExcelView, columnWidthAt column: Int) -> CGFloat 18 | func widthOfLeftHeader(in excelView: ExcelView) -> CGFloat 19 | func heightOfTopHeader(in excelView: ExcelView) -> CGFloat 20 | 21 | @objc optional func excelView(_ excelView: ExcelView, rowNameAt row: Int) -> String 22 | } 23 | 24 | @objc public protocol ExcelViewDelegate: NSObjectProtocol { 25 | @objc optional func excelView(_ excelView: ExcelView, didTapGridWith content: String) 26 | @objc optional func excelView(_ excelView: ExcelView, didTapColumnHeaderWith name: String) 27 | } 28 | 29 | open class ExcelView: UIView { 30 | open weak var dataSource: ExcelViewDataSource? { 31 | didSet { 32 | reloadData() 33 | } 34 | } 35 | open weak var delegate: ExcelViewDelegate? 36 | lazy var topHeaderScrollView: UIScrollView = UIScrollView(frame: CGRect.zero) 37 | lazy var topHeaderBottomLine: UIView = UIView() 38 | lazy var topHeaderVerticalLine: UIView = UIView() 39 | lazy var leftHeaderTableView: UITableView = UITableView(frame: CGRect.zero, style: .plain) 40 | lazy var contentScrollView: UIScrollView = UIScrollView(frame: CGRect.zero) 41 | lazy var contentTableView: UITableView = UITableView(frame: CGRect.zero, style: .plain) 42 | var contentWidth: CGFloat = 0 43 | var columnWidths = [CGFloat]() 44 | var columnNameLabels = [UILabel]() 45 | 46 | public override init(frame: CGRect) { 47 | super.init(frame: frame) 48 | setupViews() 49 | } 50 | 51 | required public init?(coder aDecoder: NSCoder) { 52 | super.init(coder: aDecoder) 53 | setupViews() 54 | } 55 | 56 | func setupViews() { 57 | topHeaderScrollView.scrollsToTop = false 58 | topHeaderScrollView.showsHorizontalScrollIndicator = false 59 | topHeaderScrollView.bounces = false 60 | topHeaderScrollView.delegate = self 61 | addSubview(topHeaderScrollView) 62 | let tap = UITapGestureRecognizer(target: self, action: #selector(didTapTopHeader(_:))) 63 | topHeaderScrollView.addGestureRecognizer(tap) 64 | 65 | topHeaderBottomLine.backgroundColor = .lightGray 66 | addSubview(topHeaderBottomLine) 67 | 68 | topHeaderVerticalLine.backgroundColor = .lightGray 69 | addSubview(topHeaderVerticalLine) 70 | 71 | leftHeaderTableView.scrollsToTop = false 72 | leftHeaderTableView.separatorStyle = .none 73 | leftHeaderTableView.showsVerticalScrollIndicator = false 74 | leftHeaderTableView.bounces = false 75 | leftHeaderTableView.register(LeftHeaderCell.self, forCellReuseIdentifier: "leftHeaderCell") 76 | leftHeaderTableView.dataSource = self 77 | leftHeaderTableView.delegate = self 78 | addSubview(leftHeaderTableView) 79 | 80 | contentScrollView.scrollsToTop = false 81 | contentScrollView.bounces = false 82 | contentScrollView.delegate = self 83 | addSubview(contentScrollView) 84 | 85 | contentTableView.scrollsToTop = true 86 | contentTableView.separatorStyle = .none 87 | contentTableView.bounces = false 88 | contentTableView.dataSource = self 89 | contentTableView.delegate = self 90 | contentScrollView.addSubview(contentTableView) 91 | 92 | if #available(iOS 11.0, *) { 93 | topHeaderScrollView.contentInsetAdjustmentBehavior = .never 94 | contentScrollView.contentInsetAdjustmentBehavior = .never 95 | } 96 | } 97 | 98 | open override func layoutSubviews() { 99 | super.layoutSubviews() 100 | 101 | guard let dataSource = dataSource else { 102 | return 103 | } 104 | let leftHeaderWidth = dataSource.widthOfLeftHeader(in: self) 105 | let topHeaderHeight = dataSource.heightOfTopHeader(in: self) 106 | topHeaderScrollView.frame = CGRect(x: leftHeaderWidth, y: 0, width: bounds.size.width - leftHeaderWidth, height: topHeaderHeight) 107 | topHeaderScrollView.contentSize = CGSize(width: contentWidth, height: topHeaderHeight) 108 | topHeaderVerticalLine.frame = CGRect(x: leftHeaderWidth - 1/UIScreen.main.scale, y: 0, width: 1/UIScreen.main.scale, height: topHeaderHeight) 109 | let topHeaderBottomLineHeight = 1/UIScreen.main.scale 110 | topHeaderBottomLine.frame = CGRect(x: 0, y: topHeaderScrollView.bounds.size.height - topHeaderBottomLineHeight, width: bounds.size.width, height: topHeaderBottomLineHeight) 111 | leftHeaderTableView.frame = CGRect(x: 0, y: topHeaderHeight, width: leftHeaderWidth, height: bounds.size.height - topHeaderHeight) 112 | contentScrollView.frame = CGRect(x: leftHeaderWidth, y: topHeaderHeight, width: topHeaderScrollView.bounds.size.width, height: leftHeaderTableView.bounds.size.height) 113 | contentScrollView.contentSize = CGSize(width: contentWidth, height: contentScrollView.bounds.size.height) 114 | contentTableView.frame = CGRect(x: 0, y: 0, width: contentWidth, height: contentScrollView.bounds.size.height) 115 | } 116 | 117 | func reloadData() { 118 | reloadTopHeader() 119 | reloadLeftHeader() 120 | } 121 | 122 | func reloadTopHeader() { 123 | guard let dataSource = dataSource else { 124 | return 125 | } 126 | topHeaderScrollView.subviews.forEach { $0.removeFromSuperview() } 127 | let columnCount = dataSource.numberOfColumns(in: self) 128 | guard columnCount > 0 else { 129 | return 130 | } 131 | let headerHeight = dataSource.heightOfTopHeader(in: self) 132 | contentWidth = 0 133 | columnWidths.removeAll() 134 | columnNameLabels.removeAll() 135 | let labelMargin: CGFloat = 5 136 | for index in 0.. Int { 176 | guard let dataSource = dataSource else { 177 | return 0 178 | } 179 | if tableView == leftHeaderTableView { 180 | return dataSource.numberOfRows(in: self) 181 | }else if tableView == contentTableView { 182 | return dataSource.numberOfRows(in: self) 183 | } 184 | return 0 185 | } 186 | 187 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 188 | guard let dataSource = dataSource else { 189 | return UITableViewCell(style: .default, reuseIdentifier: "default") 190 | } 191 | var cell: UITableViewCell? 192 | if tableView == leftHeaderTableView { 193 | cell = tableView.dequeueReusableCell(withIdentifier: "leftHeaderCell", for: indexPath) 194 | let headerCell = cell as! LeftHeaderCell 195 | if let rowName = dataSource.excelView?(self, rowNameAt: indexPath.row) { 196 | headerCell.titleLabel.text = rowName 197 | }else { 198 | headerCell.titleLabel.text = "\(indexPath.row)" 199 | } 200 | }else if tableView == contentTableView { 201 | cell = tableView.dequeueReusableCell(withIdentifier: ContentCell.cellIdentifier(columnCount: dataSource.numberOfColumns(in: self))) 202 | if cell == nil { 203 | cell = ContentCell(columnCount: dataSource.numberOfColumns(in: self)) 204 | } 205 | let contentCell = cell as! ContentCell 206 | contentCell.reloadData(rowDatas: dataSource.excelView(self, rowDataAt: indexPath.row), columnWidths: columnWidths) 207 | contentCell.didTapClosure = {[weak self] (itemContent) in 208 | self?.delegate?.excelView?(self!, didTapGridWith: itemContent) 209 | } 210 | }else { 211 | cell = UITableViewCell(style: .default, reuseIdentifier: "default") 212 | } 213 | cell?.selectionStyle = .none 214 | if indexPath.row%2 == 0 { 215 | cell?.contentView.backgroundColor = .white 216 | }else { 217 | cell?.contentView.backgroundColor = UIColor(white: 0.95, alpha: 0.75) 218 | } 219 | return cell! 220 | } 221 | } 222 | 223 | extension ExcelView: UITableViewDelegate { 224 | public func scrollViewDidScroll(_ scrollView: UIScrollView) { 225 | if scrollView == contentTableView { 226 | leftHeaderTableView.contentOffset = scrollView.contentOffset 227 | }else if scrollView == leftHeaderTableView { 228 | contentTableView.contentOffset = scrollView.contentOffset 229 | }else if scrollView == contentScrollView { 230 | topHeaderScrollView.contentOffset = scrollView.contentOffset 231 | }else if scrollView == topHeaderScrollView { 232 | contentScrollView.contentOffset = scrollView.contentOffset 233 | } 234 | } 235 | } 236 | 237 | class LeftHeaderCell: UITableViewCell { 238 | let titleLabel = UILabel() 239 | 240 | override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { 241 | super.init(style: style, reuseIdentifier: reuseIdentifier) 242 | 243 | titleLabel.font = .systemFont(ofSize: 13) 244 | titleLabel.textAlignment = .center 245 | contentView.addSubview(titleLabel) 246 | } 247 | 248 | required init?(coder aDecoder: NSCoder) { 249 | fatalError("init(coder:) has not been implemented") 250 | } 251 | 252 | override func layoutSubviews() { 253 | super.layoutSubviews() 254 | 255 | titleLabel.frame = contentView.bounds 256 | } 257 | } 258 | 259 | class ContentCell: UITableViewCell { 260 | var didTapClosure: ((String)->())? 261 | var itemLabels = [UILabel]() 262 | private var rowDatas: [String]? 263 | 264 | deinit { 265 | didTapClosure = nil 266 | } 267 | 268 | init(columnCount: Int) { 269 | super.init(style: .default, reuseIdentifier: ContentCell.cellIdentifier(columnCount: columnCount)) 270 | 271 | for _ in 0.. String { 287 | return "contentCell-\(columnCount)" 288 | } 289 | 290 | override func layoutSubviews() { 291 | super.layoutSubviews() 292 | 293 | itemLabels.forEach { (label) in 294 | label.frame.size.height = self.contentView.bounds.size.height 295 | } 296 | } 297 | 298 | @objc func didTap(_ tap: UITapGestureRecognizer) { 299 | guard rowDatas != nil else { 300 | return 301 | } 302 | let point = tap.location(in: contentView) 303 | for (index, label) in itemLabels.enumerated() { 304 | if label.frame.contains(point) { 305 | didTapClosure?(rowDatas![index]) 306 | break 307 | } 308 | } 309 | } 310 | 311 | func reloadData(rowDatas: [String], columnWidths: [CGFloat]) { 312 | self.rowDatas = rowDatas 313 | 314 | var itemWidth: CGFloat = 0 315 | let labelMargin: CGFloat = 5 316 | for index in 0..