├── .DS_Store ├── .gitignore ├── Elliotable.podspec ├── Elliotable.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── terry.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── terry.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Elliotable ├── ElliotDayOption.swift ├── Elliotable.h ├── Elliotable.swift ├── ElliotableCell.swift ├── ElliotableController.swift ├── ElliotableError.swift ├── ElliottEvent.swift └── Info.plist ├── LICENSE ├── README.md ├── README_kr.md ├── screenshot3.png ├── screenshot4.png ├── screenshot_1.png ├── screenshot_full_border.png └── screenshot_round_corner.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | 92 | -------------------------------------------------------------------------------- /Elliotable.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint Elliotable.podspec.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |spec| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | spec.name = "Elliotable" 19 | spec.version = "1.2.5" 20 | spec.summary = "This is Taein Kim's Elliotable Library which is generate timatable for lecture." 21 | 22 | # This description is used to generate tags and improve search results. 23 | # * Think: What does it do? Why did you write it? What is the focus? 24 | # * Try to keep it short, snappy and to the point. 25 | # * Write the description between the DESC delimiters below. 26 | # * Finally, don't worry about the indent, CocoaPods strips it! 27 | spec.description = "Elliotable Timetable Library for iOS Application by Taein Kim. If you use my library, you can generate timetable easily." 28 | 29 | spec.homepage = "https://terry-some.tistory.com" 30 | # spec.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 31 | 32 | 33 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 34 | # 35 | # Licensing your code is important. See https://choosealicense.com for more info. 36 | # CocoaPods will detect a license file if there is a named LICENSE* 37 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 38 | # 39 | 40 | spec.license = { :type => "MIT", :file => "LICENSE" } 41 | # spec.license = { :type => "MIT", :file => "FILE_LICENSE" } 42 | 43 | 44 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 45 | # 46 | # Specify the authors of the library, with email addresses. Email addresses 47 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 48 | # accepts just a name if you'd rather not provide an email address. 49 | # 50 | # Specify a social_media_url where others can refer to, for example a twitter 51 | # profile URL. 52 | # 53 | 54 | spec.author = { "Taein Kim" => "della.kimko@gmail.com" } 55 | # Or just: spec.author = "della-padula" 56 | # spec.authors = { "della-padula" => "della.kimko@gmail.com" } 57 | # spec.social_media_url = "https://twitter.com/della-padula" 58 | 59 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 60 | # 61 | # If this Pod runs only on iOS or OS X, then specify the platform and 62 | # the deployment target. You can optionally include the target after the platform. 63 | # 64 | 65 | spec.platform = :ios 66 | # spec.platform = :ios, "5.0" 67 | 68 | # When using multiple platforms 69 | spec.ios.deployment_target = "8.0" 70 | # spec.osx.deployment_target = "10.7" 71 | # spec.watchos.deployment_target = "2.0" 72 | # spec.tvos.deployment_target = "9.0" 73 | 74 | 75 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 76 | # 77 | # Specify the location from where the source should be retrieved. 78 | # Supports git, hg, bzr, svn and HTTP. 79 | # 80 | 81 | spec.source = { :git => "https://github.com/della-padula/Elliotable.git", :tag => "#{spec.version}" } 82 | 83 | 84 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 85 | # 86 | # CocoaPods is smart about how it includes source code. For source files 87 | # giving a folder will include any swift, h, m, mm, c & cpp files. 88 | # For header files it will include any header in the folder. 89 | # Not including the public_header_files will make all headers public. 90 | # 91 | 92 | spec.source_files = "Elliotable" 93 | # spec.exclude_files = "Classes/Exclude" 94 | 95 | spec.swift_version = "5.1" 96 | 97 | # spec.public_header_files = "Classes/**/*.h" 98 | 99 | 100 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 101 | # 102 | # A list of resources included with the Pod. These are copied into the 103 | # target bundle with a build phase script. Anything else will be cleaned. 104 | # You can preserve files from being cleaned, please don't preserve 105 | # non-essential files like tests, examples and documentation. 106 | # 107 | 108 | # spec.resource = "icon.png" 109 | # spec.resources = "Resources/*.png" 110 | 111 | # spec.preserve_paths = "FilesToSave", "MoreFilesToSave" 112 | 113 | 114 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 115 | # 116 | # Link your library with frameworks, or libraries. Libraries do not include 117 | # the lib prefix of their name. 118 | # 119 | 120 | # spec.framework = "SomeFramework" 121 | # spec.frameworks = "SomeFramework", "AnotherFramework" 122 | 123 | # spec.library = "iconv" 124 | # spec.libraries = "iconv", "xml2" 125 | 126 | 127 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 128 | # 129 | # If your library depends on compiler flags you can set them in the xcconfig hash 130 | # where they will only apply to your library. If you depend on other Podspecs 131 | # you can include multiple dependencies to ensure it works. 132 | 133 | # spec.requires_arc = true 134 | 135 | # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 136 | # spec.dependency "JSONKit", "~> 1.4" 137 | 138 | end 139 | -------------------------------------------------------------------------------- /Elliotable.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DE107B8B236D1080002998E5 /* Elliotable.h in Headers */ = {isa = PBXBuildFile; fileRef = DE107B89236D1080002998E5 /* Elliotable.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | DE107B92236D10CD002998E5 /* Elliotable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE107B91236D10CD002998E5 /* Elliotable.swift */; }; 12 | DE107B9A236D1291002998E5 /* ElliottEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE107B99236D1291002998E5 /* ElliottEvent.swift */; }; 13 | DEC9E09C236E5C19000F5908 /* ElliotDayOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC9E09B236E5C19000F5908 /* ElliotDayOption.swift */; }; 14 | DEC9E09E236E5CDB000F5908 /* ElliotableCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC9E09D236E5CDB000F5908 /* ElliotableCell.swift */; }; 15 | DEC9E0A0236E6D18000F5908 /* ElliotableController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEC9E09F236E6D18000F5908 /* ElliotableController.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | DE107B86236D1080002998E5 /* Elliotable.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Elliotable.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | DE107B89236D1080002998E5 /* Elliotable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Elliotable.h; sourceTree = ""; }; 21 | DE107B8A236D1080002998E5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 22 | DE107B91236D10CD002998E5 /* Elliotable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Elliotable.swift; sourceTree = ""; }; 23 | DE107B99236D1291002998E5 /* ElliottEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElliottEvent.swift; sourceTree = ""; }; 24 | DEC9E09B236E5C19000F5908 /* ElliotDayOption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElliotDayOption.swift; sourceTree = ""; }; 25 | DEC9E09D236E5CDB000F5908 /* ElliotableCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElliotableCell.swift; sourceTree = ""; }; 26 | DEC9E09F236E6D18000F5908 /* ElliotableController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElliotableController.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | DE107B83236D1080002998E5 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | DE107B7C236D1080002998E5 = { 41 | isa = PBXGroup; 42 | children = ( 43 | DE107B88236D1080002998E5 /* Elliotable */, 44 | DE107B87236D1080002998E5 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | DE107B87236D1080002998E5 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | DE107B86236D1080002998E5 /* Elliotable.framework */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | DE107B88236D1080002998E5 /* Elliotable */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | DE107B89236D1080002998E5 /* Elliotable.h */, 60 | DE107B8A236D1080002998E5 /* Info.plist */, 61 | DE107B91236D10CD002998E5 /* Elliotable.swift */, 62 | DE107B99236D1291002998E5 /* ElliottEvent.swift */, 63 | DEC9E09B236E5C19000F5908 /* ElliotDayOption.swift */, 64 | DEC9E09D236E5CDB000F5908 /* ElliotableCell.swift */, 65 | DEC9E09F236E6D18000F5908 /* ElliotableController.swift */, 66 | ); 67 | path = Elliotable; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXHeadersBuildPhase section */ 73 | DE107B81236D1080002998E5 /* Headers */ = { 74 | isa = PBXHeadersBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | DE107B8B236D1080002998E5 /* Elliotable.h in Headers */, 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXHeadersBuildPhase section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | DE107B85236D1080002998E5 /* Elliotable */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = DE107B8E236D1080002998E5 /* Build configuration list for PBXNativeTarget "Elliotable" */; 87 | buildPhases = ( 88 | DE107B81236D1080002998E5 /* Headers */, 89 | DE107B82236D1080002998E5 /* Sources */, 90 | DE107B83236D1080002998E5 /* Frameworks */, 91 | DE107B84236D1080002998E5 /* Resources */, 92 | ); 93 | buildRules = ( 94 | ); 95 | dependencies = ( 96 | ); 97 | name = Elliotable; 98 | productName = Elliotable; 99 | productReference = DE107B86236D1080002998E5 /* Elliotable.framework */; 100 | productType = "com.apple.product-type.framework"; 101 | }; 102 | /* End PBXNativeTarget section */ 103 | 104 | /* Begin PBXProject section */ 105 | DE107B7D236D1080002998E5 /* Project object */ = { 106 | isa = PBXProject; 107 | attributes = { 108 | LastUpgradeCheck = 1110; 109 | ORGANIZATIONNAME = TaeinKim; 110 | TargetAttributes = { 111 | DE107B85236D1080002998E5 = { 112 | CreatedOnToolsVersion = 11.1; 113 | LastSwiftMigration = 1110; 114 | }; 115 | }; 116 | }; 117 | buildConfigurationList = DE107B80236D1080002998E5 /* Build configuration list for PBXProject "Elliotable" */; 118 | compatibilityVersion = "Xcode 9.3"; 119 | developmentRegion = en; 120 | hasScannedForEncodings = 0; 121 | knownRegions = ( 122 | en, 123 | Base, 124 | ); 125 | mainGroup = DE107B7C236D1080002998E5; 126 | productRefGroup = DE107B87236D1080002998E5 /* Products */; 127 | projectDirPath = ""; 128 | projectRoot = ""; 129 | targets = ( 130 | DE107B85236D1080002998E5 /* Elliotable */, 131 | ); 132 | }; 133 | /* End PBXProject section */ 134 | 135 | /* Begin PBXResourcesBuildPhase section */ 136 | DE107B84236D1080002998E5 /* Resources */ = { 137 | isa = PBXResourcesBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | ); 141 | runOnlyForDeploymentPostprocessing = 0; 142 | }; 143 | /* End PBXResourcesBuildPhase section */ 144 | 145 | /* Begin PBXSourcesBuildPhase section */ 146 | DE107B82236D1080002998E5 /* Sources */ = { 147 | isa = PBXSourcesBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | DE107B9A236D1291002998E5 /* ElliottEvent.swift in Sources */, 151 | DEC9E0A0236E6D18000F5908 /* ElliotableController.swift in Sources */, 152 | DEC9E09E236E5CDB000F5908 /* ElliotableCell.swift in Sources */, 153 | DEC9E09C236E5C19000F5908 /* ElliotDayOption.swift in Sources */, 154 | DE107B92236D10CD002998E5 /* Elliotable.swift in Sources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXSourcesBuildPhase section */ 159 | 160 | /* Begin XCBuildConfiguration section */ 161 | DE107B8C236D1080002998E5 /* Debug */ = { 162 | isa = XCBuildConfiguration; 163 | buildSettings = { 164 | ALWAYS_SEARCH_USER_PATHS = NO; 165 | CLANG_ANALYZER_NONNULL = YES; 166 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 167 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 168 | CLANG_CXX_LIBRARY = "libc++"; 169 | CLANG_ENABLE_MODULES = YES; 170 | CLANG_ENABLE_OBJC_ARC = YES; 171 | CLANG_ENABLE_OBJC_WEAK = YES; 172 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 173 | CLANG_WARN_BOOL_CONVERSION = YES; 174 | CLANG_WARN_COMMA = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 177 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 178 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 179 | CLANG_WARN_EMPTY_BODY = YES; 180 | CLANG_WARN_ENUM_CONVERSION = YES; 181 | CLANG_WARN_INFINITE_RECURSION = YES; 182 | CLANG_WARN_INT_CONVERSION = YES; 183 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 184 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 185 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 186 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 187 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 188 | CLANG_WARN_STRICT_PROTOTYPES = YES; 189 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 190 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 191 | CLANG_WARN_UNREACHABLE_CODE = YES; 192 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 193 | COPY_PHASE_STRIP = NO; 194 | CURRENT_PROJECT_VERSION = 1; 195 | DEBUG_INFORMATION_FORMAT = dwarf; 196 | ENABLE_STRICT_OBJC_MSGSEND = YES; 197 | ENABLE_TESTABILITY = YES; 198 | GCC_C_LANGUAGE_STANDARD = gnu11; 199 | GCC_DYNAMIC_NO_PIC = NO; 200 | GCC_NO_COMMON_BLOCKS = YES; 201 | GCC_OPTIMIZATION_LEVEL = 0; 202 | GCC_PREPROCESSOR_DEFINITIONS = ( 203 | "DEBUG=1", 204 | "$(inherited)", 205 | ); 206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 208 | GCC_WARN_UNDECLARED_SELECTOR = YES; 209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 210 | GCC_WARN_UNUSED_FUNCTION = YES; 211 | GCC_WARN_UNUSED_VARIABLE = YES; 212 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 213 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 214 | MTL_FAST_MATH = YES; 215 | ONLY_ACTIVE_ARCH = YES; 216 | SDKROOT = iphoneos; 217 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 218 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 219 | SWIFT_VERSION = 5.0; 220 | VERSIONING_SYSTEM = "apple-generic"; 221 | VERSION_INFO_PREFIX = ""; 222 | }; 223 | name = Debug; 224 | }; 225 | DE107B8D236D1080002998E5 /* Release */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | CLANG_ANALYZER_NONNULL = YES; 230 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 231 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 232 | CLANG_CXX_LIBRARY = "libc++"; 233 | CLANG_ENABLE_MODULES = YES; 234 | CLANG_ENABLE_OBJC_ARC = YES; 235 | CLANG_ENABLE_OBJC_WEAK = YES; 236 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 237 | CLANG_WARN_BOOL_CONVERSION = YES; 238 | CLANG_WARN_COMMA = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 241 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 242 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INFINITE_RECURSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 249 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 252 | CLANG_WARN_STRICT_PROTOTYPES = YES; 253 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 254 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 255 | CLANG_WARN_UNREACHABLE_CODE = YES; 256 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 257 | COPY_PHASE_STRIP = NO; 258 | CURRENT_PROJECT_VERSION = 1; 259 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 260 | ENABLE_NS_ASSERTIONS = NO; 261 | ENABLE_STRICT_OBJC_MSGSEND = YES; 262 | GCC_C_LANGUAGE_STANDARD = gnu11; 263 | GCC_NO_COMMON_BLOCKS = YES; 264 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 265 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 266 | GCC_WARN_UNDECLARED_SELECTOR = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 268 | GCC_WARN_UNUSED_FUNCTION = YES; 269 | GCC_WARN_UNUSED_VARIABLE = YES; 270 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 271 | MTL_ENABLE_DEBUG_INFO = NO; 272 | MTL_FAST_MATH = YES; 273 | SDKROOT = iphoneos; 274 | SWIFT_COMPILATION_MODE = wholemodule; 275 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 276 | SWIFT_VERSION = 5.0; 277 | VALIDATE_PRODUCT = YES; 278 | VERSIONING_SYSTEM = "apple-generic"; 279 | VERSION_INFO_PREFIX = ""; 280 | }; 281 | name = Release; 282 | }; 283 | DE107B8F236D1080002998E5 /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | CLANG_ENABLE_MODULES = YES; 287 | CODE_SIGN_STYLE = Automatic; 288 | DEFINES_MODULE = YES; 289 | DEVELOPMENT_TEAM = P6E4GUVUC9; 290 | DYLIB_COMPATIBILITY_VERSION = 1; 291 | DYLIB_CURRENT_VERSION = 1; 292 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 293 | INFOPLIST_FILE = Elliotable/Info.plist; 294 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 295 | LD_RUNPATH_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "@executable_path/Frameworks", 298 | "@loader_path/Frameworks", 299 | ); 300 | PRODUCT_BUNDLE_IDENTIFIER = com.elliott.Elliotable; 301 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 302 | SKIP_INSTALL = YES; 303 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 304 | TARGETED_DEVICE_FAMILY = "1,2"; 305 | }; 306 | name = Debug; 307 | }; 308 | DE107B90236D1080002998E5 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | CLANG_ENABLE_MODULES = YES; 312 | CODE_SIGN_STYLE = Automatic; 313 | DEFINES_MODULE = YES; 314 | DEVELOPMENT_TEAM = P6E4GUVUC9; 315 | DYLIB_COMPATIBILITY_VERSION = 1; 316 | DYLIB_CURRENT_VERSION = 1; 317 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 318 | INFOPLIST_FILE = Elliotable/Info.plist; 319 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 320 | LD_RUNPATH_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "@executable_path/Frameworks", 323 | "@loader_path/Frameworks", 324 | ); 325 | PRODUCT_BUNDLE_IDENTIFIER = com.elliott.Elliotable; 326 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 327 | SKIP_INSTALL = YES; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | }; 330 | name = Release; 331 | }; 332 | /* End XCBuildConfiguration section */ 333 | 334 | /* Begin XCConfigurationList section */ 335 | DE107B80236D1080002998E5 /* Build configuration list for PBXProject "Elliotable" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | DE107B8C236D1080002998E5 /* Debug */, 339 | DE107B8D236D1080002998E5 /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | DE107B8E236D1080002998E5 /* Build configuration list for PBXNativeTarget "Elliotable" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | DE107B8F236D1080002998E5 /* Debug */, 348 | DE107B90236D1080002998E5 /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | /* End XCConfigurationList section */ 354 | }; 355 | rootObject = DE107B7D236D1080002998E5 /* Project object */; 356 | } 357 | -------------------------------------------------------------------------------- /Elliotable.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Elliotable.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Elliotable.xcodeproj/project.xcworkspace/xcuserdata/terry.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/Elliotable.xcodeproj/project.xcworkspace/xcuserdata/terry.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Elliotable.xcodeproj/xcuserdata/terry.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Elliotable.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Elliotable/ElliotDayOption.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElliotDayOption.swift 3 | // Elliotable 4 | // 5 | // Copyright © 2019 TaeinKim. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | 10 | public enum ElliotDay: Int { 11 | case monday = 1 12 | case tuesday = 2 13 | case wednesday = 3 14 | case thursday = 4 15 | case friday = 5 16 | case saturday = 6 17 | } 18 | 19 | public enum ElliotDayType: Int { 20 | case normalType 21 | case shortType 22 | case shortestType 23 | } 24 | -------------------------------------------------------------------------------- /Elliotable/Elliotable.h: -------------------------------------------------------------------------------- 1 | // 2 | // Elliotable.h 3 | // Elliotable 4 | // 5 | // Created by TaeinKim on 2019/11/02. 6 | // Copyright © 2019 TaeinKim. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Elliotable. 12 | FOUNDATION_EXPORT double ElliotableVersionNumber; 13 | 14 | //! Project version string for Elliotable. 15 | FOUNDATION_EXPORT const unsigned char ElliotableVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /Elliotable/Elliotable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Elliotable.swift 3 | // Elliotable 4 | // 5 | // Copyright © 2019 TaeinKim. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | public protocol ElliotableDelegate { 12 | func elliotable(elliotable: Elliotable, didSelectCourse selectedCourse: ElliottEvent) 13 | 14 | func elliotable(elliotable: Elliotable, didLongSelectCourse longSelectedCourse : ElliottEvent) 15 | } 16 | 17 | public protocol ElliotableDataSource { 18 | func elliotable(elliotable: Elliotable, at dayPerIndex: Int) -> String 19 | 20 | func numberOfDays(in elliotable: Elliotable) -> Int 21 | 22 | func courseItems(in elliotable: Elliotable) -> [ElliottEvent] 23 | } 24 | 25 | public enum roundOption: Int { 26 | case none = 0 27 | case left = 1 28 | case right = 2 29 | case all = 3 30 | } 31 | 32 | @IBDesignable public class Elliotable: UIView { 33 | private let controller = ElliotableController() 34 | private let collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: UICollectionViewFlowLayout()) 35 | 36 | public let defaultMinHour: Int = 9 37 | public let defaultMaxEnd : Int = 17 38 | 39 | public var userDaySymbol: [String]? 40 | public var delegate: ElliotableDelegate? 41 | public var dataSource: ElliotableDataSource? 42 | 43 | public var courseCells = [ElliotableCell]() 44 | 45 | public var startDay = ElliotDay.monday { 46 | didSet { 47 | makeTimeTable() 48 | } 49 | } 50 | 51 | public var timeTableScrollEnabled: Bool = true { 52 | didSet { 53 | collectionView.isScrollEnabled = timeTableScrollEnabled 54 | } 55 | } 56 | 57 | public var isFullBorder: Bool = false { 58 | didSet { 59 | makeTimeTable() 60 | } 61 | } 62 | 63 | @IBInspectable public var courseItemHeight : CGFloat = 60.0 { 64 | didSet { 65 | makeTimeTable() 66 | } 67 | } 68 | 69 | @IBInspectable public var weekDayTextColor = UIColor.black { 70 | didSet { 71 | makeTimeTable() 72 | } 73 | } 74 | 75 | public var courseItems = [ElliottEvent]() { 76 | didSet { 77 | makeTimeTable() 78 | } 79 | } 80 | 81 | public var roundCorner: roundOption = roundOption.none { 82 | didSet { 83 | makeTimeTable() 84 | } 85 | } 86 | 87 | @IBInspectable public var elliotBackgroundColor = UIColor.clear { 88 | didSet { 89 | collectionView.backgroundColor = backgroundColor 90 | } 91 | } 92 | 93 | @IBInspectable public var symbolBackgroundColor = UIColor.clear { 94 | didSet { 95 | makeTimeTable() 96 | } 97 | } 98 | 99 | @IBInspectable public var symbolFontSize = CGFloat(10) { 100 | didSet { 101 | makeTimeTable() 102 | } 103 | } 104 | 105 | @IBInspectable public var symbolTimeFontSize = CGFloat(10) { 106 | didSet { 107 | makeTimeTable() 108 | } 109 | } 110 | 111 | @IBInspectable public var symbolFontColor = UIColor.black { 112 | didSet { 113 | makeTimeTable() 114 | } 115 | } 116 | 117 | @IBInspectable public var symbolTimeFontColor = UIColor.black { 118 | didSet { 119 | makeTimeTable() 120 | } 121 | } 122 | 123 | @IBInspectable public var heightOfDaySection = CGFloat(28) { 124 | didSet { 125 | makeTimeTable() 126 | } 127 | } 128 | 129 | @IBInspectable public var widthOfTimeAxis = CGFloat(32) { 130 | didSet { 131 | makeTimeTable() 132 | } 133 | } 134 | 135 | @IBInspectable public var borderWidth = CGFloat(0) { 136 | didSet { 137 | makeTimeTable() 138 | } 139 | } 140 | 141 | @IBInspectable public var borderColor = UIColor.clear { 142 | didSet { 143 | makeTimeTable() 144 | } 145 | } 146 | 147 | @IBInspectable public var borderCornerRadius = CGFloat(0) { 148 | didSet { 149 | self.makeTimeTable() 150 | } 151 | } 152 | 153 | private var rectEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) { 154 | didSet { 155 | self.makeTimeTable() 156 | } 157 | } 158 | 159 | @IBInspectable public var textEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) { 160 | didSet { 161 | self.makeTimeTable() 162 | } 163 | } 164 | 165 | @IBInspectable public var courseItemTextSize = CGFloat(11) { 166 | didSet { 167 | self.makeTimeTable() 168 | } 169 | } 170 | 171 | @IBInspectable public var roomNameFontSize = CGFloat(9) { 172 | didSet { 173 | self.makeTimeTable() 174 | } 175 | } 176 | 177 | @IBInspectable public var courseTextAlignment = NSTextAlignment.center { 178 | didSet { 179 | self.makeTimeTable() 180 | } 181 | } 182 | 183 | @IBInspectable public var courseItemMaxNameLength = 0 { 184 | didSet { 185 | self.makeTimeTable() 186 | } 187 | } 188 | 189 | public var daySymbols: [String] { 190 | var daySymbolText = [String]() 191 | 192 | if let count = self.dataSource?.numberOfDays(in: self) { 193 | for index in 0.. maxEndTimeHour { 279 | maxEndTimeHour = tempEndTimeHour 280 | } 281 | } 282 | } 283 | maxEndTimeHour += 1 284 | } 285 | minimumCourseStartTime = minStartTimeHour 286 | 287 | for (index, courseItem) in courseItems.enumerated() { 288 | let dayCount = dataSource?.numberOfDays(in: self) ?? 6 289 | let weekdayIndex = (courseItem.courseDay.rawValue - startDay.rawValue + dayCount) % dayCount 290 | 291 | let courseStartHour = Int(courseItem.startTime.split(separator: ":")[0]) ?? 09 292 | let courseStartMin = Int(courseItem.startTime.split(separator: ":")[1]) ?? 00 293 | 294 | let courseEndHour = Int(courseItem.endTime.split(separator: ":")[0]) ?? 18 295 | let courseEndMin = Int(courseItem.endTime.split(separator: ":")[1]) ?? 00 296 | let averageHeight = courseItemHeight 297 | 298 | // Cell X Position and Y Position 299 | let position_x = collectionView.bounds.minX + widthOfTimeAxis + averageWidth * CGFloat(weekdayIndex) + rectEdgeInsets.left 300 | 301 | // 요일 높이 + 평균 셀 높이 * 시간 차이 개수 + 분에 대한 추가 여백 302 | let position_y = collectionView.frame.minY + heightOfDaySection + averageHeight * CGFloat(courseStartHour - minStartTimeHour) + 303 | CGFloat((CGFloat(courseStartMin) / 60) * averageHeight) + rectEdgeInsets.top 304 | 305 | let width = averageWidth 306 | let height = averageHeight * CGFloat(courseEndHour - courseStartHour) + 307 | CGFloat((CGFloat(courseEndMin - courseStartMin) / 60) * averageHeight) - rectEdgeInsets.top - rectEdgeInsets.bottom 308 | 309 | // MARK: Elliotable Course Item Cell 310 | let view = UIView(frame: CGRect(x: position_x, y: position_y, width: width, height: height)) 311 | view.backgroundColor = courseItem.backgroundColor 312 | 313 | switch(self.roundCorner) { 314 | case roundOption.none: 315 | view.layer.cornerRadius = 0 316 | break 317 | case roundOption.left: 318 | let path = UIBezierPath(roundedRect:view.bounds, 319 | byRoundingCorners:[.topLeft, .bottomRight], 320 | cornerRadii: CGSize(width: self.borderCornerRadius, height: self.borderCornerRadius)) 321 | let maskLayer = CAShapeLayer() 322 | maskLayer.path = path.cgPath 323 | view.layer.mask = maskLayer 324 | break 325 | case roundOption.right: 326 | let path = UIBezierPath(roundedRect:view.bounds, 327 | byRoundingCorners:[.topRight, .bottomLeft], 328 | cornerRadii: CGSize(width: self.borderCornerRadius, height: self.borderCornerRadius)) 329 | let maskLayer = CAShapeLayer() 330 | maskLayer.path = path.cgPath 331 | view.layer.mask = maskLayer 332 | break 333 | case roundOption.all: 334 | // To Support under iOS 11 335 | let path = UIBezierPath(roundedRect:view.bounds, 336 | byRoundingCorners:[.topRight, .topLeft, .bottomLeft, .bottomRight], 337 | cornerRadii: CGSize(width: self.borderCornerRadius, height: self.borderCornerRadius)) 338 | let maskLayer = CAShapeLayer() 339 | maskLayer.path = path.cgPath 340 | view.layer.mask = maskLayer 341 | break 342 | } 343 | 344 | let label = PaddingLabel(frame: CGRect(x: textEdgeInsets.left, y: textEdgeInsets.top, width: view.frame.width - textEdgeInsets.right, height: view.frame.height - textEdgeInsets.top)) 345 | var name = courseItem.courseName 346 | 347 | if courseItemMaxNameLength > 0 { 348 | name.truncate(courseItemMaxNameLength) 349 | } 350 | 351 | let attrStr = NSMutableAttributedString(string: name + "\n" + courseItem.roomName, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: roomNameFontSize)]) 352 | attrStr.setAttributes([NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: courseItemTextSize)], range: NSRange(0.. Array { 400 | return Array(suffix(count - middle) + prefix(middle)) 401 | } 402 | 403 | mutating func rotate(shiftingToStart middle: Index) { 404 | self = rotated(shiftingToStart: middle) 405 | } 406 | } 407 | 408 | extension String { 409 | func truncated(_ length: Int) -> String { 410 | let end = index(startIndex, offsetBy: length, limitedBy: endIndex) ?? endIndex 411 | return String(self[.. CGFloat { 421 | return UILabel.textWidth(label: self) 422 | } 423 | 424 | class func textWidth(label: UILabel) -> CGFloat { 425 | return textWidth(label: label, text: label.text!) 426 | } 427 | 428 | class func textWidth(label: UILabel, text: String) -> CGFloat { 429 | return textWidth(font: label.font, text: text) 430 | } 431 | 432 | class func textWidth(font: UIFont, text: String) -> CGFloat { 433 | let myText = text as NSString 434 | 435 | let rect = CGSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude) 436 | let labelSize = myText.boundingRect(with: rect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: font], context: nil) 437 | return ceil(labelSize.width) 438 | } 439 | } 440 | -------------------------------------------------------------------------------- /Elliotable/ElliotableCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElliotableCell.swift 3 | // Elliotable 4 | // 5 | // Copyright © 2019 TaeinKim. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | public class ElliotableCell: UICollectionViewCell { 12 | let textLabel = PaddingLabel() 13 | var borderLayer = CALayer() 14 | 15 | override init(frame: CGRect) { 16 | super.init(frame: frame) 17 | borderLayer.frame = self.bounds 18 | layer.addSublayer(borderLayer) 19 | 20 | textLabel.textAlignment = .right 21 | addSubview(textLabel) 22 | } 23 | 24 | required init?(coder aDecoder: NSCoder) { 25 | super.init(coder: aDecoder) 26 | } 27 | 28 | override public func layoutSubviews() { 29 | super.layoutSubviews() 30 | textLabel.frame = bounds 31 | } 32 | 33 | override public func prepareForReuse() { 34 | super.prepareForReuse() 35 | } 36 | } 37 | 38 | @IBDesignable class PaddingLabel: UILabel { 39 | private var padding: UIEdgeInsets = UIEdgeInsets.zero 40 | 41 | @IBInspectable var topInset: CGFloat = 0.0 42 | @IBInspectable var bottomInset: CGFloat = 0.0 43 | @IBInspectable var leftInset: CGFloat = 0.0 44 | @IBInspectable var rightInset: CGFloat = 0.0 45 | 46 | override func drawText(in rect: CGRect) { 47 | let insets = UIEdgeInsets.init(top: topInset, left: leftInset, bottom: bottomInset, right: rightInset) 48 | super.drawText(in: rect.inset(by: insets)) 49 | } 50 | 51 | override var intrinsicContentSize: CGSize { 52 | let size = super.intrinsicContentSize 53 | return CGSize(width: size.width + leftInset + rightInset, 54 | height: size.height + topInset + bottomInset) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Elliotable/ElliotableController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElliotableController.swift 3 | // Elliotable 4 | // 5 | // Copyright © 2019 TaeinKim. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | private let reuseIdentifier = "Cell" 12 | 13 | class ElliotableController: UIViewController { 14 | weak var elliotable: Elliotable! 15 | weak var collectionView: UICollectionView! { 16 | didSet { 17 | collectionView.isScrollEnabled = true 18 | collectionView.register(ElliotableCell.self, forCellWithReuseIdentifier: reuseIdentifier) 19 | } 20 | } 21 | } 22 | 23 | extension ElliotableController: UICollectionViewDataSource { 24 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 25 | var minStartTimeHour: Int = 09 26 | var maxEndTimeHour: Int = 17 27 | 28 | if elliotable.courseItems.count < 1 { 29 | minStartTimeHour = elliotable.defaultMinHour 30 | maxEndTimeHour = elliotable.defaultMaxEnd 31 | } else { 32 | 33 | for (index, courseItem) in elliotable.courseItems.enumerated() { 34 | let tempStartTimeHour = Int(courseItem.startTime.split(separator: ":")[0]) ?? 24 35 | let tempEndTimeHour = Int(courseItem.endTime.split(separator: ":")[0]) ?? 00 36 | 37 | if index < 1 { 38 | minStartTimeHour = tempStartTimeHour 39 | maxEndTimeHour = tempEndTimeHour 40 | } else { 41 | if tempStartTimeHour < minStartTimeHour { 42 | minStartTimeHour = tempStartTimeHour 43 | } 44 | 45 | if tempEndTimeHour > maxEndTimeHour { 46 | maxEndTimeHour = tempEndTimeHour 47 | } 48 | } 49 | } 50 | maxEndTimeHour += 1 51 | } 52 | 53 | // The number of rows in timetable 54 | let courseCount = maxEndTimeHour - minStartTimeHour + 1 55 | // 7 = 6 + 1 56 | return (courseCount + 1) * (elliotable.daySymbols.count + 1) 57 | } 58 | 59 | internal func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 60 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! ElliotableCell 61 | let backgroundView = UIView(frame: CGRect(x: 0, y: 0, width: cell.frame.width, height: cell.frame.height)) 62 | let titleLabel = PaddingLabel(frame: CGRect(x: 0, y: 0, width: cell.frame.width, height: cell.frame.height)) 63 | 64 | backgroundView.layer.addBorder(edge: UIRectEdge.bottom, color: elliotable.borderColor, thickness: elliotable.borderWidth) 65 | backgroundView.backgroundColor = .clear 66 | backgroundView.tag = 9 67 | 68 | for view in cell.subviews { 69 | if view.tag == 9 { 70 | view.removeFromSuperview() 71 | } 72 | } 73 | 74 | cell.textLabel.textColor = elliotable.weekDayTextColor 75 | 76 | // 0,0 77 | if indexPath.row == 0 { 78 | titleLabel.text = "" 79 | cell.setNeedsDisplay() 80 | backgroundView.backgroundColor = elliotable.symbolBackgroundColor 81 | 82 | if elliotable.isFullBorder { 83 | backgroundView.layer.addBorder(edge: UIRectEdge.left, color: elliotable.borderColor, thickness: elliotable.borderWidth) 84 | 85 | backgroundView.layer.addBorder(edge: UIRectEdge.top, color: elliotable.borderColor, thickness: elliotable.borderWidth) 86 | } 87 | 88 | backgroundView.layer.addBorder(edge: UIRectEdge.right, color: elliotable.borderColor, thickness: elliotable.borderWidth) 89 | 90 | } else if indexPath.row < (elliotable.daySymbols.count + 1) { 91 | // Week Day Section 92 | if indexPath.row < elliotable.daySymbols.count { 93 | if elliotable.isFullBorder { 94 | backgroundView.layer.addBorder(edge: UIRectEdge.top, color: elliotable.borderColor, thickness: elliotable.borderWidth) 95 | } 96 | 97 | backgroundView.layer.addBorder(edge: UIRectEdge.right, color: elliotable.borderColor, thickness: elliotable.borderWidth) 98 | } else { 99 | if elliotable.isFullBorder { 100 | backgroundView.layer.addBorder(edge: UIRectEdge.top, color: elliotable.borderColor, thickness: elliotable.borderWidth) 101 | 102 | backgroundView.layer.addBorder(edge: UIRectEdge.right, color: elliotable.borderColor, thickness: elliotable.borderWidth) 103 | } 104 | } 105 | cell.setNeedsDisplay() 106 | 107 | titleLabel.text = elliotable.daySymbols[indexPath.row - 1] 108 | titleLabel.textAlignment = .center 109 | titleLabel.font = UIFont.boldSystemFont(ofSize: elliotable.symbolFontSize) 110 | titleLabel.textColor = elliotable.symbolFontColor 111 | backgroundView.backgroundColor = elliotable.symbolBackgroundColor 112 | 113 | } else if indexPath.row % (elliotable.daySymbols.count + 1) == 0 { 114 | // Time Section 115 | if elliotable.isFullBorder { 116 | backgroundView.layer.addBorder(edge: UIRectEdge.left, color: elliotable.borderColor, thickness: elliotable.borderWidth) 117 | } 118 | backgroundView.layer.addBorder(edge: UIRectEdge.right, color: elliotable.borderColor, thickness: elliotable.borderWidth) 119 | titleLabel.text = "\((elliotable.minimumCourseStartTime ?? 9) - 1 + (indexPath.row / (elliotable.daySymbols.count + 1)))" 120 | titleLabel.textAlignment = .right 121 | titleLabel.sizeToFit() 122 | titleLabel.rightInset = 3 123 | titleLabel.frame = CGRect(x: 0, y: 0, width: cell.frame.width, height: titleLabel.frame.height) 124 | titleLabel.font = UIFont.systemFont(ofSize: elliotable.symbolTimeFontSize) 125 | titleLabel.textColor = elliotable.symbolTimeFontColor 126 | backgroundView.backgroundColor = elliotable.symbolBackgroundColor 127 | 128 | } else { 129 | cell.textLabel.text = "" 130 | cell.setNeedsDisplay() 131 | backgroundView.layer.addBorder(edge: UIRectEdge.right, color: elliotable.borderColor, thickness: elliotable.borderWidth) 132 | backgroundView.backgroundColor = elliotable.elliotBackgroundColor 133 | 134 | } 135 | 136 | backgroundView.addSubview(titleLabel) 137 | cell.addSubview(backgroundView) 138 | return cell 139 | } 140 | } 141 | 142 | extension ElliotableController: UICollectionViewDelegateFlowLayout { 143 | 144 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 145 | 146 | // Calculate average Height 147 | var minStartTimeHour: Int = 24 148 | var maxEndTimeHour: Int = 0 149 | 150 | if elliotable.courseItems.count < 1 { 151 | minStartTimeHour = elliotable.defaultMinHour 152 | maxEndTimeHour = elliotable.defaultMaxEnd 153 | } else { 154 | for (index, courseItem) in elliotable.courseItems.enumerated() { 155 | let tempStartTimeHour = Int(courseItem.startTime.split(separator: ":")[0]) ?? 24 156 | let tempEndTimeHour = Int(courseItem.endTime.split(separator: ":")[0]) ?? 00 157 | 158 | if index < 1 { 159 | minStartTimeHour = tempStartTimeHour 160 | maxEndTimeHour = tempEndTimeHour 161 | } else { 162 | if tempStartTimeHour < minStartTimeHour { 163 | minStartTimeHour = tempStartTimeHour 164 | } 165 | 166 | if tempEndTimeHour > maxEndTimeHour { 167 | maxEndTimeHour = tempEndTimeHour 168 | } 169 | } 170 | } 171 | maxEndTimeHour += 1 172 | } 173 | 174 | if indexPath.row == 0 { 175 | return CGSize(width: elliotable.widthOfTimeAxis, height: elliotable.heightOfDaySection) 176 | } else if indexPath.row < (elliotable.daySymbols.count + 1) { 177 | return CGSize(width: elliotable.averageWidth, height: elliotable.heightOfDaySection) 178 | } else if indexPath.row % (elliotable.daySymbols.count + 1) == 0 { 179 | return CGSize(width: elliotable.widthOfTimeAxis, height: elliotable.courseItemHeight) 180 | } else { 181 | return CGSize(width: elliotable.averageWidth, height: elliotable.courseItemHeight) 182 | } 183 | } 184 | 185 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { 186 | return 0 187 | } 188 | 189 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { 190 | return 0 191 | } 192 | 193 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 194 | 195 | } 196 | 197 | } 198 | 199 | extension CALayer { 200 | 201 | func addBorder(edge: UIRectEdge, color: UIColor, thickness: CGFloat) { 202 | 203 | let border = CALayer() 204 | 205 | switch edge { 206 | case UIRectEdge.top: 207 | border.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: thickness) 208 | break 209 | case UIRectEdge.bottom: 210 | border.frame = CGRect(x: 0, y: self.frame.height - thickness, width: self.frame.width, height: thickness) 211 | break 212 | case UIRectEdge.left: 213 | border.frame = CGRect(x: 0, y: 0, width: thickness, height: self.frame.height) 214 | break 215 | case UIRectEdge.right: 216 | border.frame = CGRect(x: self.frame.width - thickness, y: 0, width: thickness, height: self.frame.height) 217 | break 218 | default: 219 | break 220 | } 221 | border.backgroundColor = color.cgColor; 222 | 223 | self.addSublayer(border) 224 | } 225 | 226 | } 227 | -------------------------------------------------------------------------------- /Elliotable/ElliotableError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElliotableError.swift 3 | // Elliotable 4 | // 5 | // Created by TaeinKim on 2019/11/20. 6 | // Copyright © 2019 TaeinKim. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum ElliotableError : Error { 12 | case invalidStartTime 13 | case invalidEndTime 14 | } 15 | -------------------------------------------------------------------------------- /Elliotable/ElliottEvent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ElliottEvent.swift 3 | // Elliotable 4 | // 5 | // Copyright © 2019 TaeinKim. All rights reserved. 6 | // 7 | 8 | import Foundation 9 | import UIKit 10 | 11 | public struct ElliottEvent { 12 | public let courseId : String 13 | public let courseName: String 14 | public let roomName : String 15 | public let professor : String 16 | public let courseDay : ElliotDay 17 | public let startTime : String 18 | public let endTime : String 19 | public let textColor : UIColor? 20 | public let backgroundColor: UIColor 21 | 22 | public init(courseId: String, courseName: String, roomName: String, professor: String, courseDay: ElliotDay,startTime: String, endTime: String, textColor: UIColor?, backgroundColor: UIColor) { 23 | self.courseId = courseId 24 | self.courseName = courseName 25 | self.roomName = roomName 26 | self.professor = professor 27 | self.courseDay = courseDay 28 | self.startTime = startTime 29 | self.endTime = endTime 30 | self.textColor = textColor 31 | self.backgroundColor = backgroundColor 32 | } 33 | 34 | public init(courseId: String, courseName: String, roomName: String, professor: String, courseDay: ElliotDay,startTime: String, endTime: String, backgroundColor: UIColor) { 35 | self.courseId = courseId 36 | self.courseName = courseName 37 | self.roomName = roomName 38 | self.professor = professor 39 | self.courseDay = courseDay 40 | self.startTime = startTime 41 | self.endTime = endTime 42 | self.textColor = UIColor.white 43 | self.backgroundColor = backgroundColor 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Elliotable/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elliotable 2 | Elliotable is simple library to generate **Timetable** of University. 3 | If you only add a course, **the course time is automatically calculated** and added to the timetable. 4 | 5 | ### Released Service using Elliotable 6 | Yourssu Ground iOS : [App Store Link](https://apps.apple.com/kr/app/%EA%B7%B8%EB%9D%BC%EC%9A%B4%EB%93%9C/id1483838254) 7 | 8 | XCode 12.3 Build Success!! 9 | 10 | ### What's New in v1.2.5 11 | - Professor Name Added 12 | 13 | ### Demo Project 14 | Go to [Demo Project Git](https://github.com/della-padula/ElliotableDemo) 15 | 16 | ## Swift UI Supported 17 | Go to [ElliotableSwiftUI](https://github.com/della-padula/ElliotableSwiftUI) for Swift UI. 18 | 19 | ## Korean Version 20 | Click the link below to view the Korean version READMD.md. 21 | [한국어 사용 가이드](./README_kr.md) 22 | 23 | ## Android Version 24 | [MinTimetable](https://github.com/islandparadise14/MinTimetable) 25 | 26 | ## Author Information 27 | Timetable Library for iOS Development 28 | Author : Denny.K (Taein Kim) / Seoul, South Korea 29 | Email : della.kimko@gmail.com 30 | YouTube : https://www.youtube.com/channel/UC7W2lBYHzGYlIZogDNbwUxA 31 | Blog : https://terry-some.tistory.com/ 32 | Newest Version : 1.2.5 (Cocoapods) 33 | 34 | [![Version](https://img.shields.io/badge/version-v1.2.5-green.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 35 | [![Version](https://img.shields.io/badge/ios-11.0-blue.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 36 | [![Version](https://img.shields.io/cocoapods/v/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 37 | [![License](https://img.shields.io/cocoapods/l/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 38 | [![Platform](https://img.shields.io/cocoapods/p/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 39 | 40 | ## Screenshot 41 | 42 | #### Portrait & Landscape Timetable 43 | ![screenshot](./screenshot_1.png) 44 | 45 | ## Installation 46 | ### Cocoapods 47 | Elliotable is available through CocoaPods, to install it simply add the following line to your Podfile: 48 | ```ruby 49 | pod 'Elliotable' 50 | ``` 51 | 52 | ## Usage 53 | 54 | ### Course Item Structure 55 | ```swift 56 | courseId : The identifier of the course 57 | courseName : The name of the course 58 | roomName : The name of the lecture room 59 | professor : Professor Name 60 | courseDay : Weekday of the course 61 | startTime : Start time of course (String type - format : "HH:mm") 62 | endTime : End time of course (String type - format : "HH:mm") 63 | backgroundColor : backgroud color of each course item 64 | (Optional) textColor: Course Item Text Color 65 | ``` 66 | 67 | ### How to use 68 | On your storyboard, just add a **View** Component. 69 | On the Inspector Frame, choose the View class to **Elliotable** 70 | ![screenshot](./screenshot3.png) 71 | This is screenshot how to bind the view into swift file. 72 | ![screenshot](./screenshot4.png) 73 | 74 | 75 | First, import my library by adding line below. 76 | ```swift 77 | import Elliotable 78 | ``` 79 | And then, create courses to add to the timetable. 80 | ```swift 81 | let course_1 = ElliottEvent(courseId: "c0001", courseName: "Operating System", roomName: "IT Building 21204", professor: "TEST", courseDay: .tuesday, startTime: "12:00", endTime: "13:15", backgroundColor: [UIColor]) 82 | 83 | let course_2 = ElliottEvent(courseId: "c0002", courseName: "Operating System", roomName: "IT Building 21204", professor: "TEST", courseDay: .thursday, startTime: "12:00", endTime: "13:15", textColor: UIColor.white, backgroundColor: [UIColor]) 84 | ``` 85 | Finally, define the properties of the timetable. 86 | ```swift 87 | @IBOutlet var elliotable: Elliotable! 88 | ``` 89 | 90 | ## Delegate Pattern 91 | Elliotable uses Delegate Pattern. 92 | ```swift 93 | class ViewController : UIViewController, ElliotableDelegate, ElliotableDataSource { 94 | 95 | } 96 | ``` 97 | ```swift 98 | // Delegate Pattern 99 | elliotable.delegate = self 100 | elliotable.dataSource = self 101 | ``` 102 | ## Course Item Application 103 | To apply the course, please use the courseItems method among the Delegate methods. 104 | ```swift 105 | // Set course Items 106 | func courseItems(in elliotable: Elliotable) -> [ElliottEvent] { 107 | return courseList 108 | } 109 | ``` 110 | ## Update Course Item 111 | If you change the course item, you should call the reloadData function to allow new data to be applied. 112 | ```swift 113 | elliotable.reloadData() 114 | ``` 115 | 116 | ## Course Item Event Listener 117 | There are two touch events for lecture items, a regular touch event and a long touch event. 118 | ```swift 119 | // Course Tap Event 120 | func elliotable(elliotable: Elliotable, didSelectCourse selectedCourse: ElliottEvent) { } 121 | 122 | // Course Long Press Event 123 | func elliotable(elliotable: Elliotable, didLongSelectCourse longSelectedCourse : ElliottEvent) { } 124 | ``` 125 | ## Course Item Round Corder Option Configuration 126 | If you want to process the round for the lecture item, you can apply the following options. 127 | ```swift 128 | // Course Item Round Option : .none, .all, .left(topLeft, bottomRight), .right(topRight, bottomLeft) 129 | elliotable.roundCorner = .none 130 | ``` 131 | ![screenshot](./screenshot_round_corner.png) 132 | 133 | ## Day Symbol Definition 134 | ```swift 135 | private let daySymbol = ["Mon", "Tue", "Wed", "Thu", "Fri"] 136 | ``` 137 | 138 | ## Day Section Configuration 139 | The section representing the day of the week can be implemented using textPerIndex and numberOfDays. 140 | ```swift 141 | func elliotable(elliotable: Elliotable, at textPerIndex: Int) -> String { 142 | return self.daySymbol[textPerIndex] 143 | } 144 | 145 | func numberOfDays(in elliotable: Elliotable) -> Int { 146 | return self.daySymbol.count 147 | } 148 | ``` 149 | 150 | ## Border Option Configuration 151 | To apply the timetable border properties, you can apply them as follows. For the result screen, see screenshots. 152 | ```swift 153 | // Full Border Option 154 | elliotable.isFullBorder = true 155 | ``` 156 | ![screenshot](./screenshot_full_border.png) 157 | 158 | Other Timetable Properties 159 | ```swift 160 | // Table Item Properties 161 | elliotable.elliotBackgroundColor = UIColor.white 162 | elliotable.borderWidth = 1 163 | elliotable.borderColor = UIColor(red: 0.85, green: 0.85, blue: 0.85, alpha: 1.0) 164 | 165 | // Course Item Properties 166 | elliotable.textEdgeInsets = UIEdgeInsets(top: 2, left: 3, bottom: 2, right: 10) 167 | elliotable.courseItemMaxNameLength = 18 168 | elliotable.courseItemTextSize = 12.5 169 | elliotable.courseTextAlignment = .left 170 | // Course Item Round Radius 171 | elliotable.borderCornerRadius = 24 172 | elliotable.roomNameFontSize = 8 173 | 174 | // courseItemHeight - default : 60.0 175 | elliottable.courseItemHeight = 70.0 176 | 177 | // Day Symbol & Leftside Time Symbol Properties 178 | elliotable.symbolFontSize = 14 179 | elliotable.symbolTimeFontSize = 12 180 | elliotable.symbolFontColor = UIColor(displayP3Red: 0.1, green: 0.1, blue: 0.1, alpha: 1.0) 181 | elliotable.symbolTimeFontColor = UIColor(displayP3Red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) 182 | elliotable.symbolBackgroundColor = UIColor(named: "main_bg") ?? .white 183 | ``` 184 | 185 | -------------------------------------------------------------------------------- /README_kr.md: -------------------------------------------------------------------------------- 1 | # Elliotable 2 | Elliotable은 간단하게 대한민국 대학교 시간표를 누구나 손쉽게 구현할 수 있도록 만들어진 라이브러리입니다. 3 | 개발자분들은 강의만 추가해주시면 기본적인 시간표를 만들 수 있으며 제공되는 다양한 옵션들을 통해 커스텀화할 수 있습니다. 4 | 본 라이브러리는 **시간표의 시작 시각과 종료 시각을 자동으로 계산**하여 적용합니다. 5 | 강의 아이템을 추가하면 **가장 빠른 시간**과 **가장 늦은 시간**을 계산하여 시간표를 구성해줍니다. 6 | 7 | XCode 12.3 대응을 위하여 빌드를 하였고 성공하였습니다!! 8 | 9 | ### What's New in v1.2.5 10 | - 교수 이름 추가 11 | 12 | ### 샘플 프로젝트 13 | [Demo Project Git](https://github.com/della-padula/ElliotableDemo) 14 | 15 | ### 개발자 정보 16 | iOS 개발을 위한 시간표 라이브러리 17 | 개발자 : 김태인 (Denny.K) / 서울, 대한민국 18 | 이메일 : della.kimko@gmail.com 19 | 블로그 : https://terry-some.tistory.com/ 20 | 최신 버전 : 1.2.5 (Cocoapods) 21 | 22 | [![Version](https://img.shields.io/badge/version-v1.2.5-green.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 23 | [![Version](https://img.shields.io/badge/ios-11.0-blue.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 24 | [![Version](https://img.shields.io/cocoapods/v/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 25 | [![License](https://img.shields.io/cocoapods/l/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 26 | [![Platform](https://img.shields.io/cocoapods/p/Elliotable.svg?style=flat)](http://cocoapods.org/pods/Elliotable) 27 | 28 | ## 스크린샷 29 | #### 세로 화면 및 가로 화면 시간표 30 | ![screenshot](./screenshot_1.png) 31 | 32 | ## 설치 방법 33 | 34 | ### Cocoapods 35 | Elliotable은 Cocoapods을 통해 배포되었습니다. Podfile에 다음을 추가 한 후 pod install 을 통해 라이브러리를 적용할 수 있습니다. : 36 | ```ruby 37 | pod 'Elliotable' 38 | ``` 39 | 40 | ## 라이브러리 사용 41 | 42 | ### 강의 아이템 구조 43 | ```swift 44 | courseId : 강의 고유번호(ID) 45 | courseName : 강의 이름 46 | roomName : 강의실 이름(예 : 정보과학관 21101) 47 | professor: 교수 이름 48 | courseDay : 요일 49 | startTime : 강의 시작 시간(형식 - "HH:mm") 50 | endTime : 강의 종료 시간(형식 - "HH:mm") 51 | backgroundColor : 강의 아이템 배경 색상 52 | (Optional) textColor: 강의 아이템 글씨 색상 (선택적으로 적용 가능한 옵션) 53 | ``` 54 | 55 | ### 사용 방법 56 | 스토리보드에서 "View"를 추가합니다. 57 | Inspector 창에서 추가한 View의 class를 "Elliotable"로 선택합니다. 58 | ![screenshot](./screenshot3.png) 59 | 다음 사진은 view를 swift파일에 바인딩하는 것을 보여주는 스크린샷입니다. 60 | ![screenshot](./screenshot4.png) 61 | 62 | 63 | 우선 import를 합니다. 64 | ```swift 65 | import Elliotable 66 | ``` 67 | 시간표 강의 아이템들을 원하는 만큼 추가해줍니다. 68 | ```swift 69 | let course_1 = ElliottEvent(courseId: "c0001", courseName: "Operating System", roomName: "IT Building 21204", professor: "TEST", courseDay: .tuesday, startTime: "12:00", endTime: "13:15", backgroundColor: [UIColor]) 70 | 71 | let course_2 = ElliottEvent(courseId: "c0002", courseName: "Operating System", roomName: "IT Building 21204", professor: "TEST", courseDay: .thursday, startTime: "12:00", endTime: "13:15", textColor: UIColor.white, backgroundColor: [UIColor]) 72 | ``` 73 | 아울렛 변수를 선언해줍니다. 74 | ```swift 75 | @IBOutlet var elliotable: Elliotable! 76 | ``` 77 | ## Delegate Pattern 78 | Elliotable는 Delegate Pattern을 사용합니다. 79 | ```swift 80 | class ViewController : UIViewController, ElliotableDelegate, ElliotableDataSource { 81 | 82 | } 83 | ``` 84 | ```swift 85 | // Delegate Pattern 86 | elliotable.delegate = self 87 | elliotable.dataSource = self 88 | ``` 89 | ## 강의 아이템 적용 90 | 강의 아이템을 시간표에 적용하려면 Delegate Pattern 메소드를 활용하여 적용할 수 있습니다. 아래와 같이 말이죠. 91 | ```swift 92 | // Set course Items 93 | func courseItems(in elliotable: Elliotable) -> [ElliottEvent] { 94 | return courseList 95 | } 96 | ``` 97 | ## 강의 아이템 변경(업데이트) 98 | 강의 아이템 리스트가 변경될 경우 (추가, 삭제, 변경 등) reloadData() 함수를 반드시 호출해주어야 시간표가 갱신됩니다. 99 | ```swift 100 | elliotable.reloadData() 101 | ``` 102 | 103 | ## 강의 아이템 터치 이벤트 처리 104 | 두 가지 터치 이벤트가 있습니다. (일반 터치 이벤트, 롱 터치 이벤트) Delegate Method를 사용하여 터치 이벤트를 처리할 수 있습니다. 105 | ```swift 106 | // Course Tap Event 107 | func elliotable(elliotable: Elliotable, didSelectCourse selectedCourse: ElliottEvent) { } 108 | 109 | // Course Long Press Event 110 | func elliotable(elliotable: Elliotable, didLongSelectCourse longSelectedCourse : ElliottEvent) { } 111 | ``` 112 | ## 강의 아이템 라운드 코너링 처리 113 | Elliotable은 4가지 라운드 처리를 지원합니다. 스크린샷을 참고하여 적용하시기 바랍니다. 114 | ```swift 115 | // Course Item Round Option : .none, .all, .left(topLeft, bottomRight), .right(topRight, bottomLeft) 116 | elliotable.roundCorner = .none 117 | ``` 118 | ![screenshot](./screenshot_round_corner.png) 119 | 120 | ## 요일 텍스트 정의 121 | ```swift 122 | private let daySymbol = ["Mon", "Tue", "Wed", "Thu", "Fri"] 123 | ``` 124 | 125 | ## 요일 부분 설정 126 | 요일 텍스트는 DataSource Delegate Method 중 elliotable(elliotable:, at textPerIndex:) 함수와 numberOfDays(in elliotable:) 함수를 사용하여 적용할 수 있습니다. 127 | ```swift 128 | func elliotable(elliotable: Elliotable, at textPerIndex: Int) -> String { 129 | return self.daySymbol[textPerIndex] 130 | } 131 | 132 | func numberOfDays(in elliotable: Elliotable) -> Int { 133 | return self.daySymbol.count 134 | } 135 | ``` 136 | 137 | ## 시간표 전체 테두리 설정 138 | 시간표 전체 부분에 대하여 테두리 유무를 설정할 수 있습니다. 스크린 샷을 참고하여 적용하시기 바랍니다. 139 | ```swift 140 | // Full Border Option 141 | elliotable.isFullBorder = true 142 | ``` 143 | ![screenshot](./screenshot_full_border.png) 144 | 145 | 기타 시간표 속성들 146 | ```swift 147 | // Table Item Properties 148 | elliotable.elliotBackgroundColor = UIColor.white 149 | elliotable.borderWidth = 1 150 | elliotable.borderColor = UIColor(red: 0.85, green: 0.85, blue: 0.85, alpha: 1.0) 151 | 152 | // Course Item Properties 153 | elliotable.textEdgeInsets = UIEdgeInsets(top: 2, left: 3, bottom: 2, right: 10) 154 | elliotable.courseItemMaxNameLength = 18 155 | elliotable.courseItemTextSize = 12.5 156 | elliotable.courseTextAlignment = .left 157 | // 시간표 강의 아이템 라운드 158 | elliotable.borderCornerRadius = 24 159 | elliotable.roomNameFontSize = 8 160 | 161 | // courseItemHeight - default : 60.0 162 | elliottable.courseItemHeight = 70.0 163 | 164 | // Day Symbol & Leftside Time Symbol Properties 165 | elliotable.symbolFontSize = 14 166 | elliotable.symbolTimeFontSize = 12 167 | elliotable.symbolFontColor = UIColor(displayP3Red: 0.1, green: 0.1, blue: 0.1, alpha: 1.0) 168 | elliotable.symbolTimeFontColor = UIColor(displayP3Red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) 169 | elliotable.symbolBackgroundColor = UIColor(named: "main_bg") ?? .white 170 | ``` 171 | 172 | -------------------------------------------------------------------------------- /screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/screenshot3.png -------------------------------------------------------------------------------- /screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/screenshot4.png -------------------------------------------------------------------------------- /screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/screenshot_1.png -------------------------------------------------------------------------------- /screenshot_full_border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/screenshot_full_border.png -------------------------------------------------------------------------------- /screenshot_round_corner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bbdyno/Elliotable/80bf51d72c12fa9ef96ba0cb40459ae0bdeed3a6/screenshot_round_corner.png --------------------------------------------------------------------------------