├── .gitattributes ├── .swift-version ├── .travis.yml ├── Demo ├── PTEventViewDemo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── vinaykharab.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── vinaykharab.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── PTEventViewDemo.xcscheme │ │ └── xcschememanagement.plist ├── PTEventViewDemo │ ├── .swift-version │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── PTEventView.podspec │ ├── PTEventView │ │ ├── PTEventView.swift │ │ ├── PTEventView.xib │ │ ├── PTEventViewCell.swift │ │ ├── PTEventViewCell.xib │ │ ├── PTEventViewDelegate.swift │ │ └── PTEventViewModel.swift │ └── ViewController.swift └── PTEventViewDemoTests │ ├── Info.plist │ └── PTEventViewDemoTests.swift ├── Images ├── IBDesignable.png ├── PTEventViewDemo.gif └── PTEventViewTitle.png ├── LICENSE ├── PTEventView.podspec ├── README.md └── _config.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | PTEventView/Demo/* linguist-documentation -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: swift 2 | xcode_project: Demo/PTEventViewDemo.xcodeproj # path to your xcodeproj folder 3 | xcode_scheme: PTEventViewDemo -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 61FBE0281F5D8A6E00502FC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE0271F5D8A6E00502FC0 /* AppDelegate.swift */; }; 11 | 61FBE02A1F5D8A6E00502FC0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE0291F5D8A6E00502FC0 /* ViewController.swift */; }; 12 | 61FBE02D1F5D8A6E00502FC0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE02B1F5D8A6E00502FC0 /* Main.storyboard */; }; 13 | 61FBE02F1F5D8A6E00502FC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE02E1F5D8A6E00502FC0 /* Assets.xcassets */; }; 14 | 61FBE0321F5D8A6E00502FC0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE0301F5D8A6E00502FC0 /* LaunchScreen.storyboard */; }; 15 | 61FBE03D1F5D8A6E00502FC0 /* PTEventViewDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE03C1F5D8A6E00502FC0 /* PTEventViewDemoTests.swift */; }; 16 | 61FBE09B1F5D9DEB00502FC0 /* PTEventView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE0951F5D9DEB00502FC0 /* PTEventView.swift */; }; 17 | 61FBE09C1F5D9DEB00502FC0 /* PTEventView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE0961F5D9DEB00502FC0 /* PTEventView.xib */; }; 18 | 61FBE09D1F5D9DEB00502FC0 /* PTEventViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE0971F5D9DEB00502FC0 /* PTEventViewCell.swift */; }; 19 | 61FBE09E1F5D9DEB00502FC0 /* PTEventViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE0981F5D9DEB00502FC0 /* PTEventViewCell.xib */; }; 20 | 61FBE09F1F5D9DEB00502FC0 /* PTEventViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE0991F5D9DEB00502FC0 /* PTEventViewDelegate.swift */; }; 21 | 61FBE0A01F5D9DEB00502FC0 /* PTEventViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61FBE09A1F5D9DEB00502FC0 /* PTEventViewModel.swift */; }; 22 | 61FBE0DB1F602FCD00502FC0 /* PTEventView.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 61FBE0DA1F602FCD00502FC0 /* PTEventView.podspec */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 61FBE0391F5D8A6E00502FC0 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 61FBE01C1F5D8A6E00502FC0 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 61FBE0231F5D8A6E00502FC0; 31 | remoteInfo = PTEventViewDemo; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 61FBE0241F5D8A6E00502FC0 /* PTEventViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PTEventViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 61FBE0271F5D8A6E00502FC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 61FBE0291F5D8A6E00502FC0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 39 | 61FBE02C1F5D8A6E00502FC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 61FBE02E1F5D8A6E00502FC0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 41 | 61FBE0311F5D8A6E00502FC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 42 | 61FBE0331F5D8A6E00502FC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 43 | 61FBE0381F5D8A6E00502FC0 /* PTEventViewDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PTEventViewDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 61FBE03C1F5D8A6E00502FC0 /* PTEventViewDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PTEventViewDemoTests.swift; sourceTree = ""; }; 45 | 61FBE03E1F5D8A6E00502FC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | 61FBE0951F5D9DEB00502FC0 /* PTEventView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PTEventView.swift; path = PTEventView/PTEventView.swift; sourceTree = ""; }; 47 | 61FBE0961F5D9DEB00502FC0 /* PTEventView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PTEventView.xib; path = PTEventView/PTEventView.xib; sourceTree = ""; }; 48 | 61FBE0971F5D9DEB00502FC0 /* PTEventViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PTEventViewCell.swift; path = PTEventView/PTEventViewCell.swift; sourceTree = ""; }; 49 | 61FBE0981F5D9DEB00502FC0 /* PTEventViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PTEventViewCell.xib; path = PTEventView/PTEventViewCell.xib; sourceTree = ""; }; 50 | 61FBE0991F5D9DEB00502FC0 /* PTEventViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PTEventViewDelegate.swift; path = PTEventView/PTEventViewDelegate.swift; sourceTree = ""; }; 51 | 61FBE09A1F5D9DEB00502FC0 /* PTEventViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PTEventViewModel.swift; path = PTEventView/PTEventViewModel.swift; sourceTree = ""; }; 52 | 61FBE0DA1F602FCD00502FC0 /* PTEventView.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PTEventView.podspec; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | 61FBE0211F5D8A6E00502FC0 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | 61FBE0351F5D8A6E00502FC0 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 61FBE01B1F5D8A6E00502FC0 = { 74 | isa = PBXGroup; 75 | children = ( 76 | 61FBE0261F5D8A6E00502FC0 /* PTEventViewDemo */, 77 | 61FBE03B1F5D8A6E00502FC0 /* PTEventViewDemoTests */, 78 | 61FBE0251F5D8A6E00502FC0 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 61FBE0251F5D8A6E00502FC0 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 61FBE0241F5D8A6E00502FC0 /* PTEventViewDemo.app */, 86 | 61FBE0381F5D8A6E00502FC0 /* PTEventViewDemoTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | 61FBE0261F5D8A6E00502FC0 /* PTEventViewDemo */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 61FBE0DA1F602FCD00502FC0 /* PTEventView.podspec */, 95 | 61FBE0941F5D9DE100502FC0 /* PTEventView */, 96 | 61FBE0271F5D8A6E00502FC0 /* AppDelegate.swift */, 97 | 61FBE0291F5D8A6E00502FC0 /* ViewController.swift */, 98 | 61FBE02B1F5D8A6E00502FC0 /* Main.storyboard */, 99 | 61FBE02E1F5D8A6E00502FC0 /* Assets.xcassets */, 100 | 61FBE0301F5D8A6E00502FC0 /* LaunchScreen.storyboard */, 101 | 61FBE0331F5D8A6E00502FC0 /* Info.plist */, 102 | ); 103 | path = PTEventViewDemo; 104 | sourceTree = ""; 105 | }; 106 | 61FBE03B1F5D8A6E00502FC0 /* PTEventViewDemoTests */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 61FBE03C1F5D8A6E00502FC0 /* PTEventViewDemoTests.swift */, 110 | 61FBE03E1F5D8A6E00502FC0 /* Info.plist */, 111 | ); 112 | path = PTEventViewDemoTests; 113 | sourceTree = ""; 114 | }; 115 | 61FBE0941F5D9DE100502FC0 /* PTEventView */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 61FBE0951F5D9DEB00502FC0 /* PTEventView.swift */, 119 | 61FBE0961F5D9DEB00502FC0 /* PTEventView.xib */, 120 | 61FBE0971F5D9DEB00502FC0 /* PTEventViewCell.swift */, 121 | 61FBE0981F5D9DEB00502FC0 /* PTEventViewCell.xib */, 122 | 61FBE0991F5D9DEB00502FC0 /* PTEventViewDelegate.swift */, 123 | 61FBE09A1F5D9DEB00502FC0 /* PTEventViewModel.swift */, 124 | ); 125 | name = PTEventView; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 61FBE0231F5D8A6E00502FC0 /* PTEventViewDemo */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 61FBE0411F5D8A6E00502FC0 /* Build configuration list for PBXNativeTarget "PTEventViewDemo" */; 134 | buildPhases = ( 135 | 61FBE0201F5D8A6E00502FC0 /* Sources */, 136 | 61FBE0211F5D8A6E00502FC0 /* Frameworks */, 137 | 61FBE0221F5D8A6E00502FC0 /* Resources */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = PTEventViewDemo; 144 | productName = PTEventViewDemo; 145 | productReference = 61FBE0241F5D8A6E00502FC0 /* PTEventViewDemo.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | 61FBE0371F5D8A6E00502FC0 /* PTEventViewDemoTests */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 61FBE0441F5D8A6E00502FC0 /* Build configuration list for PBXNativeTarget "PTEventViewDemoTests" */; 151 | buildPhases = ( 152 | 61FBE0341F5D8A6E00502FC0 /* Sources */, 153 | 61FBE0351F5D8A6E00502FC0 /* Frameworks */, 154 | 61FBE0361F5D8A6E00502FC0 /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | 61FBE03A1F5D8A6E00502FC0 /* PBXTargetDependency */, 160 | ); 161 | name = PTEventViewDemoTests; 162 | productName = PTEventViewDemoTests; 163 | productReference = 61FBE0381F5D8A6E00502FC0 /* PTEventViewDemoTests.xctest */; 164 | productType = "com.apple.product-type.bundle.unit-test"; 165 | }; 166 | /* End PBXNativeTarget section */ 167 | 168 | /* Begin PBXProject section */ 169 | 61FBE01C1F5D8A6E00502FC0 /* Project object */ = { 170 | isa = PBXProject; 171 | attributes = { 172 | LastSwiftUpdateCheck = 0820; 173 | LastUpgradeCheck = 0820; 174 | ORGANIZATIONNAME = "Aman Taneja"; 175 | TargetAttributes = { 176 | 61FBE0231F5D8A6E00502FC0 = { 177 | CreatedOnToolsVersion = 8.2.1; 178 | ProvisioningStyle = Automatic; 179 | }; 180 | 61FBE0371F5D8A6E00502FC0 = { 181 | CreatedOnToolsVersion = 8.2.1; 182 | ProvisioningStyle = Automatic; 183 | TestTargetID = 61FBE0231F5D8A6E00502FC0; 184 | }; 185 | }; 186 | }; 187 | buildConfigurationList = 61FBE01F1F5D8A6E00502FC0 /* Build configuration list for PBXProject "PTEventViewDemo" */; 188 | compatibilityVersion = "Xcode 3.2"; 189 | developmentRegion = English; 190 | hasScannedForEncodings = 0; 191 | knownRegions = ( 192 | en, 193 | Base, 194 | ); 195 | mainGroup = 61FBE01B1F5D8A6E00502FC0; 196 | productRefGroup = 61FBE0251F5D8A6E00502FC0 /* Products */; 197 | projectDirPath = ""; 198 | projectRoot = ""; 199 | targets = ( 200 | 61FBE0231F5D8A6E00502FC0 /* PTEventViewDemo */, 201 | 61FBE0371F5D8A6E00502FC0 /* PTEventViewDemoTests */, 202 | ); 203 | }; 204 | /* End PBXProject section */ 205 | 206 | /* Begin PBXResourcesBuildPhase section */ 207 | 61FBE0221F5D8A6E00502FC0 /* Resources */ = { 208 | isa = PBXResourcesBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | 61FBE0DB1F602FCD00502FC0 /* PTEventView.podspec in Resources */, 212 | 61FBE0321F5D8A6E00502FC0 /* LaunchScreen.storyboard in Resources */, 213 | 61FBE09C1F5D9DEB00502FC0 /* PTEventView.xib in Resources */, 214 | 61FBE02F1F5D8A6E00502FC0 /* Assets.xcassets in Resources */, 215 | 61FBE02D1F5D8A6E00502FC0 /* Main.storyboard in Resources */, 216 | 61FBE09E1F5D9DEB00502FC0 /* PTEventViewCell.xib in Resources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | 61FBE0361F5D8A6E00502FC0 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | }; 227 | /* End PBXResourcesBuildPhase section */ 228 | 229 | /* Begin PBXSourcesBuildPhase section */ 230 | 61FBE0201F5D8A6E00502FC0 /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 61FBE09B1F5D9DEB00502FC0 /* PTEventView.swift in Sources */, 235 | 61FBE0A01F5D9DEB00502FC0 /* PTEventViewModel.swift in Sources */, 236 | 61FBE09D1F5D9DEB00502FC0 /* PTEventViewCell.swift in Sources */, 237 | 61FBE02A1F5D8A6E00502FC0 /* ViewController.swift in Sources */, 238 | 61FBE0281F5D8A6E00502FC0 /* AppDelegate.swift in Sources */, 239 | 61FBE09F1F5D9DEB00502FC0 /* PTEventViewDelegate.swift in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | 61FBE0341F5D8A6E00502FC0 /* Sources */ = { 244 | isa = PBXSourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | 61FBE03D1F5D8A6E00502FC0 /* PTEventViewDemoTests.swift in Sources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | /* End PBXSourcesBuildPhase section */ 252 | 253 | /* Begin PBXTargetDependency section */ 254 | 61FBE03A1F5D8A6E00502FC0 /* PBXTargetDependency */ = { 255 | isa = PBXTargetDependency; 256 | target = 61FBE0231F5D8A6E00502FC0 /* PTEventViewDemo */; 257 | targetProxy = 61FBE0391F5D8A6E00502FC0 /* PBXContainerItemProxy */; 258 | }; 259 | /* End PBXTargetDependency section */ 260 | 261 | /* Begin PBXVariantGroup section */ 262 | 61FBE02B1F5D8A6E00502FC0 /* Main.storyboard */ = { 263 | isa = PBXVariantGroup; 264 | children = ( 265 | 61FBE02C1F5D8A6E00502FC0 /* Base */, 266 | ); 267 | name = Main.storyboard; 268 | sourceTree = ""; 269 | }; 270 | 61FBE0301F5D8A6E00502FC0 /* LaunchScreen.storyboard */ = { 271 | isa = PBXVariantGroup; 272 | children = ( 273 | 61FBE0311F5D8A6E00502FC0 /* Base */, 274 | ); 275 | name = LaunchScreen.storyboard; 276 | sourceTree = ""; 277 | }; 278 | /* End PBXVariantGroup section */ 279 | 280 | /* Begin XCBuildConfiguration section */ 281 | 61FBE03F1F5D8A6E00502FC0 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_ANALYZER_NONNULL = YES; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 294 | CLANG_WARN_EMPTY_BODY = YES; 295 | CLANG_WARN_ENUM_CONVERSION = YES; 296 | CLANG_WARN_INFINITE_RECURSION = YES; 297 | CLANG_WARN_INT_CONVERSION = YES; 298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 299 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 300 | CLANG_WARN_UNREACHABLE_CODE = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 303 | COPY_PHASE_STRIP = NO; 304 | DEBUG_INFORMATION_FORMAT = dwarf; 305 | ENABLE_STRICT_OBJC_MSGSEND = YES; 306 | ENABLE_TESTABILITY = YES; 307 | GCC_C_LANGUAGE_STANDARD = gnu99; 308 | GCC_DYNAMIC_NO_PIC = NO; 309 | GCC_NO_COMMON_BLOCKS = YES; 310 | GCC_OPTIMIZATION_LEVEL = 0; 311 | GCC_PREPROCESSOR_DEFINITIONS = ( 312 | "DEBUG=1", 313 | "$(inherited)", 314 | ); 315 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 316 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 317 | GCC_WARN_UNDECLARED_SELECTOR = YES; 318 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 319 | GCC_WARN_UNUSED_FUNCTION = YES; 320 | GCC_WARN_UNUSED_VARIABLE = YES; 321 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 322 | MTL_ENABLE_DEBUG_INFO = YES; 323 | ONLY_ACTIVE_ARCH = YES; 324 | SDKROOT = iphoneos; 325 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 326 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 327 | }; 328 | name = Debug; 329 | }; 330 | 61FBE0401F5D8A6E00502FC0 /* Release */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | ALWAYS_SEARCH_USER_PATHS = NO; 334 | CLANG_ANALYZER_NONNULL = YES; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 343 | CLANG_WARN_EMPTY_BODY = YES; 344 | CLANG_WARN_ENUM_CONVERSION = YES; 345 | CLANG_WARN_INFINITE_RECURSION = YES; 346 | CLANG_WARN_INT_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 349 | CLANG_WARN_UNREACHABLE_CODE = YES; 350 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 351 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 352 | COPY_PHASE_STRIP = NO; 353 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 354 | ENABLE_NS_ASSERTIONS = NO; 355 | ENABLE_STRICT_OBJC_MSGSEND = YES; 356 | GCC_C_LANGUAGE_STANDARD = gnu99; 357 | GCC_NO_COMMON_BLOCKS = YES; 358 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 359 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 360 | GCC_WARN_UNDECLARED_SELECTOR = YES; 361 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 362 | GCC_WARN_UNUSED_FUNCTION = YES; 363 | GCC_WARN_UNUSED_VARIABLE = YES; 364 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 365 | MTL_ENABLE_DEBUG_INFO = NO; 366 | SDKROOT = iphoneos; 367 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 368 | VALIDATE_PRODUCT = YES; 369 | }; 370 | name = Release; 371 | }; 372 | 61FBE0421F5D8A6E00502FC0 /* Debug */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | INFOPLIST_FILE = PTEventViewDemo/Info.plist; 377 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 378 | PRODUCT_BUNDLE_IDENTIFIER = com.amantaneja.PTEventViewDemo; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | SWIFT_VERSION = 3.0; 381 | }; 382 | name = Debug; 383 | }; 384 | 61FBE0431F5D8A6E00502FC0 /* Release */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | INFOPLIST_FILE = PTEventViewDemo/Info.plist; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 390 | PRODUCT_BUNDLE_IDENTIFIER = com.amantaneja.PTEventViewDemo; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | SWIFT_VERSION = 3.0; 393 | }; 394 | name = Release; 395 | }; 396 | 61FBE0451F5D8A6E00502FC0 /* Debug */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 400 | BUNDLE_LOADER = "$(TEST_HOST)"; 401 | INFOPLIST_FILE = PTEventViewDemoTests/Info.plist; 402 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 403 | PRODUCT_BUNDLE_IDENTIFIER = com.amantaneja.PTEventViewDemoTests; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | SWIFT_VERSION = 3.0; 406 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PTEventViewDemo.app/PTEventViewDemo"; 407 | }; 408 | name = Debug; 409 | }; 410 | 61FBE0461F5D8A6E00502FC0 /* Release */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 414 | BUNDLE_LOADER = "$(TEST_HOST)"; 415 | INFOPLIST_FILE = PTEventViewDemoTests/Info.plist; 416 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 417 | PRODUCT_BUNDLE_IDENTIFIER = com.amantaneja.PTEventViewDemoTests; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | SWIFT_VERSION = 3.0; 420 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PTEventViewDemo.app/PTEventViewDemo"; 421 | }; 422 | name = Release; 423 | }; 424 | /* End XCBuildConfiguration section */ 425 | 426 | /* Begin XCConfigurationList section */ 427 | 61FBE01F1F5D8A6E00502FC0 /* Build configuration list for PBXProject "PTEventViewDemo" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | 61FBE03F1F5D8A6E00502FC0 /* Debug */, 431 | 61FBE0401F5D8A6E00502FC0 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | 61FBE0411F5D8A6E00502FC0 /* Build configuration list for PBXNativeTarget "PTEventViewDemo" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | 61FBE0421F5D8A6E00502FC0 /* Debug */, 440 | 61FBE0431F5D8A6E00502FC0 /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | defaultConfigurationName = Release; 444 | }; 445 | 61FBE0441F5D8A6E00502FC0 /* Build configuration list for PBXNativeTarget "PTEventViewDemoTests" */ = { 446 | isa = XCConfigurationList; 447 | buildConfigurations = ( 448 | 61FBE0451F5D8A6E00502FC0 /* Debug */, 449 | 61FBE0461F5D8A6E00502FC0 /* Release */, 450 | ); 451 | defaultConfigurationIsVisible = 0; 452 | defaultConfigurationName = Release; 453 | }; 454 | /* End XCConfigurationList section */ 455 | }; 456 | rootObject = 61FBE01C1F5D8A6E00502FC0 /* Project object */; 457 | } 458 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/project.xcworkspace/xcuserdata/vinaykharab.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amantaneja/PTEventView/49aca48dd49c26c31cb0db3bf3e7fd681d6ac643/Demo/PTEventViewDemo.xcodeproj/project.xcworkspace/xcuserdata/vinaykharab.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/xcuserdata/vinaykharab.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/xcuserdata/vinaykharab.xcuserdatad/xcschemes/PTEventViewDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo.xcodeproj/xcuserdata/vinaykharab.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PTEventViewDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 61FBE0231F5D8A6E00502FC0 16 | 17 | primary 18 | 19 | 20 | 61FBE0371F5D8A6E00502FC0 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/.swift-version: -------------------------------------------------------------------------------- 1 | 3.0.2 2 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PTEventViewDemo 4 | // 5 | // Created by Vinay Kharb on 9/4/17. 6 | // Copyright © 2017 Aman Taneja. 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: [UIApplicationLaunchOptionsKey: 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 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/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 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/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 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PTEventView' 3 | s.version = '0.3.0' 4 | s.summary = 'An Event View based on Apple’s Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.' 5 | 6 | s.description = <<-DESC 7 | An Event View based on Apple’s Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.It also allows changing the color of Event View and the EventView Text. 8 | DESC 9 | 10 | s.homepage = 'https://github.com/amantaneja/PTEventView' 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'Aman Taneja' => 'taneja.aman161@gmail.com' } 13 | s.source = { :git => 'https://github.com/amantaneja/PTEventView.git', :tag => s.version.to_s } 14 | 15 | s.ios.deployment_target = '10.0' 16 | s.source_files = 'PTEventView/*' 17 | 18 | end 19 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView/PTEventView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PTEventView.swift 3 | // PTEventViewDemo 4 | // 5 | // Created by Aman Taneja on 9/1/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @IBDesignable 12 | class PTEventView: UIView { 13 | 14 | /** 15 | Border Color of Calender View 16 | */ 17 | @IBInspectable open var borderColor: UIColor = UIColor.darkGray { 18 | didSet { 19 | self.layer.borderColor = borderColor.cgColor 20 | } 21 | } 22 | 23 | /** 24 | Border Width of Calender View 25 | */ 26 | @IBInspectable open var borderWidth: CGFloat = 1.0 { 27 | didSet { 28 | self.layer.borderWidth = borderWidth 29 | } 30 | } 31 | 32 | /** 33 | Corner Radius of Calender View 34 | */ 35 | @IBInspectable open var cornerRadius: CGFloat = 6.0 { 36 | didSet { 37 | self.layer.cornerRadius = cornerRadius 38 | self.clipsToBounds = true 39 | } 40 | } 41 | 42 | /** 43 | TableViews for CalenderView 44 | */ 45 | @IBOutlet weak var eventTableView: UITableView! 46 | @IBOutlet weak var timeTableView: UITableView! 47 | 48 | /** 49 | CalenderView Protocol 50 | */ 51 | @IBOutlet open weak var delegate: PTEventViewProtocol? 52 | 53 | /** 54 | Model for Storing Values 55 | */ 56 | var calenderModel = [Dictionary]() 57 | 58 | var is24HourFormat: Bool = false 59 | 60 | /** 61 | Is CalenderView Tapped 62 | */ 63 | var isClicked: Bool = false 64 | 65 | /** 66 | Color of Event View 67 | */ 68 | var eventColor: UIColor = UIColor(red: 58/255, green: 181/255, blue: 244/255, alpha: 1) 69 | 70 | /** 71 | Color of Event Text Label 72 | */ 73 | var eventTextColor: UIColor = UIColor.white 74 | 75 | fileprivate var startTimes = [Int]() 76 | 77 | fileprivate var endTimes = [Int]() 78 | 79 | fileprivate var events = [String]() 80 | 81 | 82 | var EventViewdataModel = [PTEventViewModel]() 83 | 84 | /** 85 | Sets up the PTEventView. Manages data, views and registers Tableviews. 86 | - Parameter frame: frame of PTEventView 87 | */ 88 | func setup(frame: CGRect){ 89 | 90 | self.frame = frame 91 | self.layer.cornerRadius = cornerRadius 92 | self.layer.borderColor = borderColor.cgColor 93 | self.layer.borderWidth = borderWidth 94 | self.clipsToBounds = true 95 | 96 | setUpTableViewSize(isOpen: false) 97 | 98 | if !is24HourFormat{ 99 | setupData() 100 | } else{ 101 | setup24HourData() 102 | } 103 | 104 | self.addEvent(startTimes: startTimes, endTimes: endTimes, eventNames: events) 105 | 106 | eventTableView.register(UINib(nibName: "PTEventViewCell", bundle: nil), forCellReuseIdentifier: "PTEventViewCell") 107 | timeTableView.register(UINib(nibName: "PTEventViewCell", bundle: nil), forCellReuseIdentifier: "PTEventViewCell") 108 | 109 | self.addSubview(eventTableView) 110 | self.addSubview(timeTableView) 111 | 112 | let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapBlurButton(_:))) 113 | self.addGestureRecognizer(tapGesture) 114 | } 115 | 116 | /** 117 | Convert EventModel to array of startTimes and endTimes. 118 | */ 119 | func setupData() { 120 | for event in EventViewdataModel { 121 | if event.startTime!.localizedCaseInsensitiveContains("AM") || event.startTime!.localizedCaseInsensitiveContains("A.M.") || event.startTime!.localizedCaseInsensitiveContains("A M") { 122 | if let number = Int(event.startTime!.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()) { 123 | startTimes.append(number) 124 | } else { 125 | print("Incorrect Format") 126 | } 127 | } else { 128 | if let number = Int(event.startTime!.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()) { 129 | startTimes.append(number+12) 130 | } else { 131 | print("Incorrect Format") 132 | } 133 | } 134 | 135 | if event.endTime!.localizedCaseInsensitiveContains("AM") || event.endTime!.localizedCaseInsensitiveContains("A.M.") || event.endTime!.localizedCaseInsensitiveContains("A M") { 136 | if let number = Int(event.endTime!.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()) { 137 | endTimes.append(number) 138 | } else { 139 | print("Incorrect Format") 140 | } 141 | } else { 142 | if let number = Int(event.endTime!.components(separatedBy: CharacterSet.decimalDigits.inverted).joined()) { 143 | endTimes.append(number+12) 144 | } else { 145 | print("Incorrect Format") 146 | } 147 | } 148 | events.append(event.eventName!) 149 | } 150 | } 151 | 152 | /** 153 | Sets up the 24 hour model 154 | */ 155 | func setup24HourData() { 156 | for event in EventViewdataModel{ 157 | if let number = Int(event.startTime!){ 158 | startTimes.append(number) 159 | } else { 160 | print("Incorrect Format") 161 | } 162 | 163 | if let number = Int(event.endTime!){ 164 | endTimes.append(number) 165 | } else { 166 | print("Incorrect Format") 167 | } 168 | events.append(event.eventName!) 169 | } 170 | } 171 | 172 | /** 173 | Sets up the PTEventView tableview frame and view frame. 174 | - Parameter isOpen: Deceides if the PTEventView should open or close 175 | */ 176 | func setUpTableViewSize(isOpen: Bool) { 177 | 178 | if isOpen { 179 | self.eventTableView.frame = CGRect(origin: self.eventTableView.frame.origin, size: self.eventTableView.contentSize) 180 | self.timeTableView.frame = CGRect(origin: self.timeTableView.frame.origin, size: self.timeTableView.contentSize) 181 | 182 | } else { 183 | self.timeTableView.frame = CGRect(origin: self.timeTableView.frame.origin, size: CGSize(width: self.timeTableView.frame.width, height: 132)) 184 | 185 | self.eventTableView.frame = CGRect(origin: self.eventTableView.frame.origin, size: CGSize(width: self.frame.width-63, height: 132)) 186 | } 187 | } 188 | 189 | /** 190 | Receiver for Tap Click on PTEventView 191 | - Parameter sender: TapGestureRecognizer 192 | */ 193 | func tapBlurButton(_ sender: UITapGestureRecognizer) { 194 | 195 | self.layoutIfNeeded() 196 | 197 | UIView.animate(withDuration: 0.3, animations: { 198 | 199 | if self.isClicked { 200 | 201 | self.delegate?.willClosePTEventView?(height: 132) 202 | 203 | self.frame = CGRect(origin: self.frame.origin, size: CGSize(width: self.frame.size.width, height: 132)) 204 | 205 | self.setUpTableViewSize(isOpen: false) 206 | self.isClicked = false 207 | 208 | } else { 209 | if self.timeTableView.contentSize.height == 0 { 210 | return 211 | } 212 | self.delegate?.willOpenPTEventView?(height: self.timeTableView.contentSize.height) 213 | 214 | self.frame = CGRect(origin: self.frame.origin, size: CGSize(width: self.frame.size.width, height: self.timeTableView.contentSize.height)) 215 | 216 | self.setUpTableViewSize(isOpen: true) 217 | self.isClicked = true 218 | } 219 | self.layoutIfNeeded() 220 | 221 | }) { (true) in 222 | if !self.isClicked { 223 | self.delegate?.didClosePTEventView?(height: 132) 224 | } else { 225 | if self.timeTableView.contentSize.height == 0 { 226 | return 227 | } else { 228 | self.delegate?.didOpenPTEventView?(height: self.timeTableView.contentSize.height) 229 | } 230 | } 231 | } 232 | } 233 | } 234 | 235 | extension PTEventView : UITabBarDelegate, UITableViewDataSource { 236 | func numberOfSections(in tableView: UITableView) -> Int { 237 | 238 | return 1 239 | } 240 | 241 | 242 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 243 | 244 | if tableView == self.eventTableView{ 245 | return calenderModel.count-1 246 | } else { 247 | return calenderModel.count 248 | } 249 | } 250 | 251 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 252 | 253 | let returnCell = tableView.dequeueReusableCell(withIdentifier: "PTEventViewCell", for: indexPath) as! PTEventViewCell 254 | 255 | var cellModel = calenderModel[indexPath.row] 256 | 257 | if tableView == self.eventTableView { 258 | 259 | if cellModel["event"] != "" { 260 | returnCell.cellLabel.text = cellModel["eventName"] 261 | returnCell.contentView.backgroundColor = eventColor 262 | returnCell.cellLabel.textColor = eventTextColor 263 | } else{ 264 | returnCell.cellLabel.text = "" 265 | returnCell.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) 266 | } 267 | 268 | } else if tableView == self.timeTableView{ 269 | 270 | returnCell.cellLabel.font = UIFont(name: "HelveticaNeue-Thin", size: 9.0)! 271 | returnCell.cellLabel.textColor = UIColor.lightGray 272 | returnCell.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) 273 | 274 | returnCell.cellLabel.text = cellModel["time"]! 275 | } 276 | 277 | return returnCell 278 | } 279 | } 280 | 281 | extension PTEventView { 282 | func addEvent(startTimes: [Int], endTimes: [Int], eventNames: [String]) { 283 | 284 | if startTimes.count==0 || endTimes.count==0 { 285 | delegate?.didReceiveErrorWhilePlottingEventView?() 286 | return 287 | } 288 | for i in startTimes.min()!-1..() 291 | 292 | if i==12 { 293 | valueDict["time"] = "Noon" 294 | } else { 295 | valueDict["time"] = i<13 ? i.description + " AM" : (i-12).description + " PM" 296 | } 297 | 298 | if startTimes.contains(i){ 299 | let indexOfElement = startTimes.index(of: i) 300 | valueDict["eventName"] = eventNames[indexOfElement!] 301 | } else { 302 | valueDict["eventName"] = "" 303 | } 304 | 305 | if i>=startTimes.first! && i=startTimes[index] && i 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 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView/PTEventViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PTEventViewCellTableViewCell.swift 3 | // PTEventViewDemo 4 | // 5 | // Created by Vinay Kharb on 9/1/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PTEventViewCell: UITableViewCell { 12 | 13 | @IBOutlet weak var cellLabel: UILabel! 14 | override func awakeFromNib() { 15 | super.awakeFromNib() 16 | // Initialization code 17 | } 18 | 19 | override func setSelected(_ selected: Bool, animated: Bool) { 20 | super.setSelected(selected, animated: animated) 21 | 22 | // Configure the view for the selected state 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView/PTEventViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView/PTEventViewDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CalenderViewDelegate.swift 3 | // CalenderView 4 | // 5 | // Created by Aman Taneja on 8/26/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** 12 | Optional delegate that can be used to be notified whenever the user 13 | taps on a Calender View 14 | */ 15 | 16 | @objc protocol PTEventViewProtocol { 17 | 18 | /** 19 | Called before PTEventView is to be opened. Do all the constraint expanding changes in this method. 20 | - Parameter height: Returns height of PTEventView 21 | */ 22 | @objc optional func willOpenPTEventView(height:CGFloat) 23 | 24 | /** 25 | Called after PTEventView is opened. Allows after expanding animations. 26 | - Parameter height: Returns height of PTEventView 27 | 28 | */ 29 | @objc optional func didOpenPTEventView(height:CGFloat) 30 | 31 | /** 32 | Called before PTEventView is to be closed. Do all the constraint compressing changes in this method. 33 | - Parameter height: Returns height of PTEventView 34 | 35 | */ 36 | @objc optional func willClosePTEventView(height:CGFloat) 37 | 38 | /** 39 | Called after PTEventView is closed. Allows after compressing animations. 40 | - Parameter height: Returns height of PTEventView 41 | 42 | */ 43 | @objc optional func didClosePTEventView(height:CGFloat) 44 | 45 | /** 46 | Called if the data is not in the correct format. You can choose to hide PTEventView in this method. 47 | */ 48 | @objc optional func didReceiveErrorWhilePlottingEventView() 49 | } 50 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/PTEventView/PTEventViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PTEventViewModel.swift 3 | // CalenderView 4 | // 5 | // Created by Aman Taneja on 8/30/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PTEventViewModel: NSObject { 12 | var startTime : String? 13 | var endTime : String? 14 | var eventName : String? 15 | } 16 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CalenderView 4 | // 5 | // Created by Aman Taneja on 8/18/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var heightConstraint: NSLayoutConstraint! 14 | @IBOutlet weak var PTEventView: PTEventView! 15 | let events = [["5","9","WWDC KickOff"],["12","15","Swift Meetup '17"]] 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | let ptEventView = Bundle.main.loadNibNamed("PTEventView", owner: nil, options: nil)![0] as? PTEventView 21 | ptEventView?.delegate = self 22 | 23 | for event in events{ 24 | 25 | let eventModel = PTEventViewModel() 26 | 27 | eventModel.startTime = event[0] 28 | eventModel.endTime = event[1] 29 | eventModel.eventName = event[2] 30 | ptEventView?.EventViewdataModel.append(eventModel) 31 | } 32 | 33 | ptEventView?.is24HourFormat = true 34 | ptEventView?.setup(frame: PTEventView.frame) 35 | self.view.addSubview(ptEventView!) 36 | 37 | } 38 | 39 | override func didReceiveMemoryWarning() { 40 | super.didReceiveMemoryWarning() 41 | // Dispose of any resources that can be recreated. 42 | } 43 | } 44 | 45 | extension ViewController: PTEventViewProtocol { 46 | 47 | func willOpenPTEventView(height: CGFloat) { 48 | UIView.animate(withDuration: 0.4, animations: { 49 | self.heightConstraint.constant = height 50 | self.view.layoutIfNeeded() 51 | 52 | }) 53 | } 54 | 55 | func willClosePTEventView(height: CGFloat) { 56 | UIView.animate(withDuration: 0.4, animations: { 57 | self.heightConstraint.constant = height 58 | self.view.layoutIfNeeded() 59 | 60 | }) 61 | } 62 | 63 | func didClosePTEventView(height: CGFloat) { 64 | print("Closed") 65 | } 66 | 67 | func didOpenPTEventView(height: CGFloat) { 68 | print("Opened") 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demo/PTEventViewDemoTests/PTEventViewDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PTEventViewDemoTests.swift 3 | // PTEventViewDemoTests 4 | // 5 | // Created by Vinay Kharb on 9/4/17. 6 | // Copyright © 2017 Aman Taneja. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import PTEventViewDemo 11 | 12 | class PTEventViewDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Images/IBDesignable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amantaneja/PTEventView/49aca48dd49c26c31cb0db3bf3e7fd681d6ac643/Images/IBDesignable.png -------------------------------------------------------------------------------- /Images/PTEventViewDemo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amantaneja/PTEventView/49aca48dd49c26c31cb0db3bf3e7fd681d6ac643/Images/PTEventViewDemo.gif -------------------------------------------------------------------------------- /Images/PTEventViewTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amantaneja/PTEventView/49aca48dd49c26c31cb0db3bf3e7fd681d6ac643/Images/PTEventViewTitle.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Aman Taneja 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 | -------------------------------------------------------------------------------- /PTEventView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'PTEventView' 3 | s.version = '0.3.0' 4 | s.summary = 'An Event View based on Apple’s Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.' 5 | 6 | s.description = <<-DESC 7 | An Event View based on Apple’s Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard.It also allows changing the color of Event View and the EventView Text. 8 | DESC 9 | 10 | s.homepage = 'https://github.com/amantaneja/PTEventView' 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'Aman Taneja' => 'taneja.aman161@gmail.com' } 13 | s.source = { :git => 'https://github.com/amantaneja/PTEventView.git', :tag => s.version.to_s } 14 | 15 | s.ios.deployment_target = '10.0' 16 | s.source_files = 'Demo/PTEventViewDemo/PTEventView/*' 17 | 18 | end 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | An Event View based on Apple's Event Detail View. Written in Swift 3. Supports ARC, Autolayout and editing via StoryBoard. 4 | 5 | ![License](https://img.shields.io/badge/License-MIT-lightgrey.svg) 6 | ![Platform](https://img.shields.io/badge/Platforms-iOS-red.svg) 7 | ![Swift 3.x](https://img.shields.io/badge/Swift-3.x-blue.svg) 8 | ![MadeWithLove](https://img.shields.io/badge/Made%20with%20%E2%9D%A4-India-green.svg) 9 | 10 | 11 | 12 | # Installation 13 | ### CocoaPods 14 | **PTEventView** is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile: 15 | 16 | ```swift 17 | pod 'PTEventView' 18 | ``` 19 | 20 | ### Manual 21 | You can drag and drop the Files from [here](https://github.com/amantaneja/PTEventView/tree/master/Demo/PTEventViewDemo/PTEventView) into your projects directly. 22 | 23 | # Setup 24 | ### Adding PTEventView 25 | 26 | ```swift 27 | fileprivate weak var myCalenderView: PTEventView! 28 | ``` 29 | ```swift 30 | // In loadView or viewDidLoad 31 | let ptEventView = Bundle.main.loadNibNamed("PTEventView", owner: nil, options: nil)![0] as? PTEventView 32 | ptEventView?.delegate = self 33 | ptEventView?.setup(frame: myCalenderView.frame) 34 | self.view.addSubview(ptEventView!) 35 | ``` 36 | 37 | ### Data Model 38 | PTEventView supports both 12 hour and 24 hour format as data model. The input can be received from the API or Database(Core Data, Realm, SQLite) in the form of Array of `Event Object`.
39 | The Event Object should have: 40 | - Start Time (12 hour or 24 hour) 41 | - End Time (12 hour or 24 hour) 42 | - Name of the Event
43 | **Note**: Incase of 12 hour, suffix time with AM or PM.
44 | 45 | **Example** 46 | ```swift 47 | let dataModel12hour = [["10AM","11AM","Swift Meetup '17"],["12AM","3PM","WWDC KickOff"]] 48 | let dataModel24hour = [["10","11","Swift Meetup '17"],["12","15","WWDC KickOff"]] 49 | ``` 50 | Use Bool to switch between Time Formats 51 | ```swift 52 | ptEventView?.is24HourFormat = true 53 | ``` 54 | ```swift 55 | for event in dataModel12hour{ 56 | 57 | let eventModel = PTEventViewModel() 58 | 59 | eventModel.startTime = event[0] 60 | eventModel.endTime = event[1] 61 | eventModel.eventName = event[2] 62 | 63 | ptEventView?.EventViewdataModel.append(eventModel) 64 | } 65 | ``` 66 | 67 | 68 | # StoryBoard 69 | Supports IBDesignable to alter `Border Width`, `Corner Radius` and `Border Color` 70 | 71 | 72 | ### Customization 73 | You can customize the view parameters for designing your own view: 74 | 75 | `borderColor` **- Border Color** *Default is Black* 76 | 77 | `borderWidth` **- Border Width** *Default is 1.0* 78 | 79 | `cornerRadius` **- Corner Radius** *Default is 6.0* 80 | 81 | `eventColor` **- Event Color** *Default is as given in Demo Gif* 82 | 83 | `eventTextColor` **- Event Text Color** *Default is white. Try to make it contrasting with eventColor* 84 | 85 | # ToDo[s] 86 | - [x] Add support for PM and AM via 24 hour format 87 | - [ ] Orientation Support. Currently supports UI for Portrait. 88 | - [x] Add delegation for callbacks 89 | - [ ] Implement AutoLayout for CalenderView 90 | - [ ] Support Events on the same day 91 | - [ ] Add IBInspectable for Row Color of Event 92 | 93 | ## Requirement 94 | - iOS 8.0+ (CocoaPods with Swift support will only work on iOS 8.0+. Alternatively, you will have to import library manually to your project) 95 | - Xcode 8.0+, Swift 3.0+ 96 | 97 | ## License 98 | 99 | PTEventView is released under the MIT license. See [LICENSE](https://github.com/amantaneja/PTEventView/blob/master/LICENSE) for details. 100 | 101 | 102 | [**★Star**](#) this repo. 103 | 104 | http://culturestreet.com/depot/620--auto--uploads-2013-12-Daily-quotes-5-December.jpg 105 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman --------------------------------------------------------------------------------