From 03301eec3d035c43ade8e45846c876474146090c Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Thu, 29 Mar 2018 17:17:24 +0300 Subject: [PATCH 1/7] DateFormattingService class replaced with protocol. Add SwiftDate dependency for DateFormattingService. Add ViewBackground enum that describes possible view backgrounds. Add ViewText enum that describes text with appearance options. Removed String+SizeCalculation extension. --- CHANGELOG.md | 7 + LeadKit.podspec | 5 +- LeadKit.xcodeproj/project.pbxproj | 178 ++++++++++++------ Podfile | 1 + Podfile.lock | 5 +- .../Services/DateFormattingService.swift | 72 ------- .../Views/ViewBackground.swift} | 28 +-- Sources/Enums/Views/ViewText.swift | 34 ++++ ...mattingService+DefaultImplementation.swift | 81 ++++++++ ...teFormattingService+MappingTransform.swift | 21 ++- .../String/String+SizeCalculation.swift | 82 -------- .../UILabel+ViewTextConfiguration.swift | 42 +++++ .../Views/ViewBackground+Configuration.swift} | 44 ++--- .../Views/ViewText+Extensions.swift | 71 +++++++ .../DateFormatingService/DateFormat.swift | 31 +++ .../DateFormattingService.swift | 59 ++++++ Sources/Protocols/Singleton.swift | 29 +++ 17 files changed, 526 insertions(+), 264 deletions(-) delete mode 100644 Sources/Classes/Services/DateFormattingService.swift rename Sources/{Extensions/DateFormattingArguments/DateFormattingArguments+DateFormatter.swift => Enums/Views/ViewBackground.swift} (67%) create mode 100644 Sources/Enums/Views/ViewText.swift create mode 100644 Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift delete mode 100644 Sources/Extensions/String/String+SizeCalculation.swift create mode 100644 Sources/Extensions/Views/UILabel/UILabel+ViewTextConfiguration.swift rename Sources/{Structures/DateFormatting/DateFormattingArguments.swift => Extensions/Views/ViewBackground+Configuration.swift} (51%) create mode 100644 Sources/Extensions/Views/ViewText+Extensions.swift create mode 100644 Sources/Protocols/DateFormatingService/DateFormat.swift create mode 100644 Sources/Protocols/DateFormatingService/DateFormattingService.swift create mode 100644 Sources/Protocols/Singleton.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 275eab44..15ff47f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### 0.7.2 +- **[Breaking Change]**: `DateFormattingService` class replaced with protocol. +- **Add**: `SwiftDate` dependency for `DateFormattingService`. +- **Add**: `ViewBackground` enum that describes possible view backgrounds. +- **Add**: `ViewText` enum that describes text with appearance options. +- **Removed**: `String+SizeCalculation` extension. + ### 0.7.1 - **Add**: Extension for comparing optional arrays (`[T]?`) with `Equatable` elements. - **Add**: `additionalHttpHeaders` static field in `ConfigurableNetworkService` protocol. diff --git a/LeadKit.podspec b/LeadKit.podspec index 7874d965..e9c9c4f9 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.7.1" + s.version = "0.7.2" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" @@ -69,6 +69,7 @@ Pod::Spec.new do |s| "Sources/Extensions/UIView/*", "Sources/Extensions/UIViewController/*", "Sources/Extensions/UIWindow/*", + "Sources/Extensions/Views/UILabel/*", "Sources/Protocols/LoadingIndicator.swift", "Sources/Protocols/DataLoading/PaginationDataLoading/PaginationWrappable.swift", "Sources/Protocols/DataLoading/GeneralDataLoading/GeneralDataLoadingController.swift", @@ -100,6 +101,7 @@ Pod::Spec.new do |s| ss.dependency "RxCocoa", '~> 4.1' ss.dependency "RxAlamofire", '~> 4.1' ss.dependency "ObjectMapper", '~> 3.0' + ss.dependency "SwiftDate", '~> 4.5' ss.ios.dependency "TableKit", '~> 2.6' ss.ios.dependency "UIScrollView-InfiniteScroll", '~> 1.0.0' @@ -126,6 +128,7 @@ Pod::Spec.new do |s| ss.dependency "RxCocoa", '~> 4.1' ss.dependency "RxAlamofire", '~> 4.1' ss.dependency "ObjectMapper", '~> 3.0' + ss.dependency "SwiftDate", '~> 4.5' end s.default_subspec = 'Core' diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index b9f321fb..ec752313 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -111,10 +111,6 @@ 671462C91EB3396E00EAB194 /* String+Localization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FC1EB3396E00EAB194 /* String+Localization.swift */; }; 671462CA1EB3396E00EAB194 /* String+Localization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FC1EB3396E00EAB194 /* String+Localization.swift */; }; 671462CB1EB3396E00EAB194 /* String+Localization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FC1EB3396E00EAB194 /* String+Localization.swift */; }; - 671462CC1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */; }; - 671462CD1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */; }; - 671462CE1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */; }; - 671462CF1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */; }; 671462D01EB3396E00EAB194 /* UIScrollView+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FF1EB3396E00EAB194 /* UIScrollView+Support.swift */; }; 671462D11EB3396E00EAB194 /* UIScrollView+Support.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671461FF1EB3396E00EAB194 /* UIScrollView+Support.swift */; }; 671462D41EB3396E00EAB194 /* TableDirector+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671462011EB3396E00EAB194 /* TableDirector+Extensions.swift */; }; @@ -288,6 +284,31 @@ 671AD26D206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671AD26B206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift */; }; 671AD26E206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671AD26B206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift */; }; 671AD26F206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671AD26B206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift */; }; + 67274769206CCC9D00725163 /* ViewBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274768206CCC9D00725163 /* ViewBackground.swift */; }; + 6727476A206CCCA300725163 /* ViewBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274768206CCC9D00725163 /* ViewBackground.swift */; }; + 6727476B206CCCA500725163 /* ViewBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274768206CCC9D00725163 /* ViewBackground.swift */; }; + 6727476E206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727476D206CCDDB00725163 /* ViewBackground+Configuration.swift */; }; + 6727476F206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727476D206CCDDB00725163 /* ViewBackground+Configuration.swift */; }; + 67274770206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727476D206CCDDB00725163 /* ViewBackground+Configuration.swift */; }; + 67274772206CCF1200725163 /* ViewText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274771206CCF1200725163 /* ViewText.swift */; }; + 67274773206CCF1200725163 /* ViewText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274771206CCF1200725163 /* ViewText.swift */; }; + 67274774206CCF1200725163 /* ViewText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274771206CCF1200725163 /* ViewText.swift */; }; + 67274775206CCF1200725163 /* ViewText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274771206CCF1200725163 /* ViewText.swift */; }; + 67274778206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274777206CD0B500725163 /* UILabel+ViewTextConfiguration.swift */; }; + 67274779206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274777206CD0B500725163 /* UILabel+ViewTextConfiguration.swift */; }; + 6727477A206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274777206CD0B500725163 /* UILabel+ViewTextConfiguration.swift */; }; + 6727477F206CD3BD00725163 /* ViewText+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */; }; + 67274780206CD3BD00725163 /* ViewText+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */; }; + 67274781206CD3BD00725163 /* ViewText+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */; }; + 67274782206CD3BD00725163 /* ViewText+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */; }; + 6727478A206CD83600725163 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274789206CD83600725163 /* DateFormat.swift */; }; + 6727478B206CD83600725163 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274789206CD83600725163 /* DateFormat.swift */; }; + 6727478C206CD83600725163 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274789206CD83600725163 /* DateFormat.swift */; }; + 6727478D206CD83600725163 /* DateFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67274789206CD83600725163 /* DateFormat.swift */; }; + 6727478F206CD88600725163 /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727478E206CD88600725163 /* DateFormattingService.swift */; }; + 67274790206CD88600725163 /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727478E206CD88600725163 /* DateFormattingService.swift */; }; + 67274791206CD88600725163 /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727478E206CD88600725163 /* DateFormattingService.swift */; }; + 67274792206CD88600725163 /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6727478E206CD88600725163 /* DateFormattingService.swift */; }; 673564F12068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F02068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift */; }; 673564F22068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F02068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift */; }; 673564F32068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F02068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift */; }; @@ -296,6 +317,10 @@ 673564F72068C68D00F0CBED /* NumberFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F52068C68D00F0CBED /* NumberFormat.swift */; }; 673564F82068C68D00F0CBED /* NumberFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F52068C68D00F0CBED /* NumberFormat.swift */; }; 673564F92068C68D00F0CBED /* NumberFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673564F52068C68D00F0CBED /* NumberFormat.swift */; }; + 67386A8C206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */; }; + 67386A8D206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */; }; + 67386A8E206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */; }; + 67386A8F206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */; }; 673CF40B2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673CF40A2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift */; }; 673CF40C2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673CF40A2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift */; }; 673CF40D2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673CF40A2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift */; }; @@ -330,18 +355,6 @@ 676B22A3206A626D002E9F8A /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676B22A1206A626D002E9F8A /* NSAttributedString+Extensions.swift */; }; 676B22A4206A626D002E9F8A /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676B22A1206A626D002E9F8A /* NSAttributedString+Extensions.swift */; }; 676B22A5206A626D002E9F8A /* NSAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676B22A1206A626D002E9F8A /* NSAttributedString+Extensions.swift */; }; - 6771DFD81EE99EBA002DCDAE /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */; }; - 6771DFD91EE99EBA002DCDAE /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */; }; - 6771DFDA1EE99EBA002DCDAE /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */; }; - 6771DFDB1EE99EBA002DCDAE /* DateFormattingService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */; }; - 6771DFDE1EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */; }; - 6771DFDF1EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */; }; - 6771DFE01EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */; }; - 6771DFE11EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */; }; - 6771DFE41EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */; }; - 6771DFE51EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */; }; - 6771DFE61EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */; }; - 6771DFE71EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */; }; 6771DFEA1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */; }; 6771DFEB1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */; }; 6771DFEC1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */; }; @@ -413,6 +426,10 @@ 67952C3D1EB3266200B3BA1A /* LeadKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 67186B201EB247A200CFAFFB /* LeadKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; 67952DCE1EB327B500B3BA1A /* LeadKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67952DC51EB327B400B3BA1A /* LeadKit.framework */; }; 67952DDD1EB3281300B3BA1A /* LeadKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 67186B201EB247A200CFAFFB /* LeadKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 67955D52206D216B0021ECD2 /* Singleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67955D51206D216B0021ECD2 /* Singleton.swift */; }; + 67955D53206D216B0021ECD2 /* Singleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67955D51206D216B0021ECD2 /* Singleton.swift */; }; + 67955D54206D216B0021ECD2 /* Singleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67955D51206D216B0021ECD2 /* Singleton.swift */; }; + 67955D55206D216B0021ECD2 /* Singleton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67955D51206D216B0021ECD2 /* Singleton.swift */; }; 67A1FF8F1EBCA09B00D6C89F /* UIImage+Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A1FF8E1EBCA09B00D6C89F /* UIImage+Spinner.swift */; }; 67A1FF901EBCA09B00D6C89F /* UIImage+Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A1FF8E1EBCA09B00D6C89F /* UIImage+Spinner.swift */; }; 67A1FF911EBCA09B00D6C89F /* UIImage+Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67A1FF8E1EBCA09B00D6C89F /* UIImage+Spinner.swift */; }; @@ -608,7 +625,6 @@ 671461F11EB3396E00EAB194 /* Observable+DeferredJust.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+DeferredJust.swift"; sourceTree = ""; }; 671461F61EB3396E00EAB194 /* Sequence+ConcurrentMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Sequence+ConcurrentMap.swift"; sourceTree = ""; }; 671461FC1EB3396E00EAB194 /* String+Localization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Localization.swift"; sourceTree = ""; }; - 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+SizeCalculation.swift"; sourceTree = ""; }; 671461FF1EB3396E00EAB194 /* UIScrollView+Support.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIScrollView+Support.swift"; sourceTree = ""; }; 671462011EB3396E00EAB194 /* TableDirector+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TableDirector+Extensions.swift"; sourceTree = ""; }; 671462031EB3396E00EAB194 /* TimeInterval+DateComponents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TimeInterval+DateComponents.swift"; sourceTree = ""; }; @@ -665,8 +681,16 @@ 671AD261206A35EC00EAF887 /* UIApplication+Cellular.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Cellular.swift"; sourceTree = ""; }; 671AD266206A365100EAF887 /* UIApplication+OpenUrlSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+OpenUrlSupport.swift"; sourceTree = ""; }; 671AD26B206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+TotalCountCursorListingResult.swift"; sourceTree = ""; }; + 67274768206CCC9D00725163 /* ViewBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewBackground.swift; sourceTree = ""; }; + 6727476D206CCDDB00725163 /* ViewBackground+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewBackground+Configuration.swift"; sourceTree = ""; }; + 67274771206CCF1200725163 /* ViewText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewText.swift; sourceTree = ""; }; + 67274777206CD0B500725163 /* UILabel+ViewTextConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+ViewTextConfiguration.swift"; sourceTree = ""; }; + 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewText+Extensions.swift"; sourceTree = ""; }; + 67274789206CD83600725163 /* DateFormat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormat.swift; sourceTree = ""; }; + 6727478E206CD88600725163 /* DateFormattingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormattingService.swift; sourceTree = ""; }; 673564F02068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NumberFormattingService+DefaultImplementation.swift"; sourceTree = ""; }; 673564F52068C68D00F0CBED /* NumberFormat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberFormat.swift; sourceTree = ""; }; + 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormattingService+DefaultImplementation.swift"; sourceTree = ""; }; 673CF40A2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralDataLoadingViewModel.swift; sourceTree = ""; }; 673CF4102063ABD100C329F6 /* GeneralDataLoadingState+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GeneralDataLoadingState+Extensions.swift"; sourceTree = ""; }; 673CF4172063D50700C329F6 /* GeneralDataLoadingController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralDataLoadingController.swift; sourceTree = ""; }; @@ -676,9 +700,6 @@ 673CF4372063E7CE00C329F6 /* GeneralDataLoadingController+DefaultImplementation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GeneralDataLoadingController+DefaultImplementation.swift"; sourceTree = ""; }; 674AF55B1EC45B1600038A8F /* UIActivityIndicatorView+LoadingIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIActivityIndicatorView+LoadingIndicator.swift"; sourceTree = ""; }; 676B22A1206A626D002E9F8A /* NSAttributedString+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+Extensions.swift"; sourceTree = ""; }; - 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateFormattingService.swift; sourceTree = ""; }; - 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateFormattingArguments.swift; sourceTree = ""; }; - 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DateFormattingArguments+DateFormatter.swift"; sourceTree = ""; }; 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DateFormattingService+MappingTransform.swift"; sourceTree = ""; }; 67745267206249360024EEEF /* UITableView+PaginationWrappable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableView+PaginationWrappable.swift"; sourceTree = ""; }; 6774526B206249E30024EEEF /* UICollectionView+PaginationWrappable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UICollectionView+PaginationWrappable.swift"; sourceTree = ""; }; @@ -708,6 +729,7 @@ 67952DCD1EB327B400B3BA1A /* LeadKit iOS ExtensionsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "LeadKit iOS ExtensionsTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 67952DDC1EB3280900B3BA1A /* Info-iOS-Extensions.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS-Extensions.plist"; sourceTree = ""; }; 67952DDE1EB3285A00B3BA1A /* Info-iOS-Extensions.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS-Extensions.plist"; sourceTree = ""; }; + 67955D51206D216B0021ECD2 /* Singleton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Singleton.swift; sourceTree = ""; }; 679C77D41F98F78E0094BE10 /* AlertRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertRepresentable.swift; sourceTree = ""; }; 679C77D61F98F7A60094BE10 /* UIAlertController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+Extensions.swift"; sourceTree = ""; }; 67A1FF8E1EBCA09B00D6C89F /* UIImage+Spinner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Spinner.swift"; sourceTree = ""; }; @@ -879,7 +901,6 @@ 671461D21EB3396E00EAB194 /* Services */ = { isa = PBXGroup; children = ( - 6771DFD71EE99EBA002DCDAE /* DateFormattingService.swift */, 671461D31EB3396E00EAB194 /* NetworkService.swift */, ); path = Services; @@ -902,6 +923,7 @@ 671461D61EB3396E00EAB194 /* Enums */ = { isa = PBXGroup; children = ( + 67274767206CCB6F00725163 /* Views */, 6774528A20625C860024EEEF /* DataLoading */, 671461D81EB3396E00EAB194 /* LeadKitError.swift */, 671461D91EB3396E00EAB194 /* ResizeMode.swift */, @@ -922,7 +944,6 @@ 671461E51EB3396E00EAB194 /* CGSize */, A6D10EA91F8A9269003E69DD /* Comparable */, 67745284206259C20024EEEF /* DataLoading */, - 6771DFE21EE99FF3002DCDAE /* DateFormattingArguments */, 6771DFE81EEA7C8F002DCDAE /* DateFormattingService */, 671461EA1EB3396E00EAB194 /* Double */, 6714639C1EB33AC200EAB194 /* NetworkService */, @@ -944,6 +965,7 @@ 671462111EB3396E00EAB194 /* UIView */, 671462171EB3396E00EAB194 /* UIViewController */, 6714621B1EB3396E00EAB194 /* UIWindow */, + 6727476C206CCD3100725163 /* Views */, ); path = Extensions; sourceTree = ""; @@ -1030,7 +1052,6 @@ A676AE471F97D28A001F9214 /* String+Extensions.swift */, 671461FC1EB3396E00EAB194 /* String+Localization.swift */, A6F32C071F6EBDAA00AC08EE /* String+LocalizedComponent.swift */, - 671461FD1EB3396E00EAB194 /* String+SizeCalculation.swift */, ); path = String; sourceTree = ""; @@ -1124,6 +1145,7 @@ isa = PBXGroup; children = ( 67EB7FC5206148C400BDD9FB /* DataLoading */, + 67274783206CD7E500725163 /* DateFormatingService */, 67CAF8AF20651E0F00527085 /* NetworkService */, 67C7B1772068BADA00C9EDA3 /* NumberFormattingService */, 673CF4202063D8EB00C329F6 /* Rx */, @@ -1140,6 +1162,7 @@ A676AE541F981121001F9214 /* ObservableMappable.swift */, 6714622B1EB3396E00EAB194 /* ResettableType.swift */, 6714622C1EB3396E00EAB194 /* ReuseIdentifierProtocol.swift */, + 67955D51206D216B0021ECD2 /* Singleton.swift */, 6714622E1EB3396E00EAB194 /* StaticViewHeightProtocol.swift */, 671462311EB3396E00EAB194 /* SupportProtocol.swift */, 671462321EB3396E00EAB194 /* ViewHeightProtocol.swift */, @@ -1153,7 +1176,6 @@ children = ( 677452B620627F9E0024EEEF /* DataLoading */, 671462361EB3396E00EAB194 /* Api */, - 6771DFDC1EE99F52002DCDAE /* DateFormatting */, 671462381EB3396E00EAB194 /* DrawingOperations */, 671462421EB3396E00EAB194 /* Views */, ); @@ -1270,6 +1292,42 @@ path = UIApplication; sourceTree = ""; }; + 67274767206CCB6F00725163 /* Views */ = { + isa = PBXGroup; + children = ( + 67274768206CCC9D00725163 /* ViewBackground.swift */, + 67274771206CCF1200725163 /* ViewText.swift */, + ); + path = Views; + sourceTree = ""; + }; + 6727476C206CCD3100725163 /* Views */ = { + isa = PBXGroup; + children = ( + 67274776206CD07B00725163 /* UILabel */, + 6727476D206CCDDB00725163 /* ViewBackground+Configuration.swift */, + 6727477E206CD3BD00725163 /* ViewText+Extensions.swift */, + ); + path = Views; + sourceTree = ""; + }; + 67274776206CD07B00725163 /* UILabel */ = { + isa = PBXGroup; + children = ( + 67274777206CD0B500725163 /* UILabel+ViewTextConfiguration.swift */, + ); + path = UILabel; + sourceTree = ""; + }; + 67274783206CD7E500725163 /* DateFormatingService */ = { + isa = PBXGroup; + children = ( + 67274789206CD83600725163 /* DateFormat.swift */, + 6727478E206CD88600725163 /* DateFormattingService.swift */, + ); + path = DateFormatingService; + sourceTree = ""; + }; 673564EF2068C29100F0CBED /* NumberFormattingService */ = { isa = PBXGroup; children = ( @@ -1328,26 +1386,11 @@ path = NSAttributedString; sourceTree = ""; }; - 6771DFDC1EE99F52002DCDAE /* DateFormatting */ = { - isa = PBXGroup; - children = ( - 6771DFDD1EE99F6F002DCDAE /* DateFormattingArguments.swift */, - ); - path = DateFormatting; - sourceTree = ""; - }; - 6771DFE21EE99FF3002DCDAE /* DateFormattingArguments */ = { - isa = PBXGroup; - children = ( - 6771DFE31EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift */, - ); - path = DateFormattingArguments; - sourceTree = ""; - }; 6771DFE81EEA7C8F002DCDAE /* DateFormattingService */ = { isa = PBXGroup; children = ( 6771DFE91EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift */, + 67386A8B206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift */, ); path = DateFormattingService; sourceTree = ""; @@ -2331,6 +2374,7 @@ "${BUILT_PRODUCTS_DIR}/RxAlamofire-iOS/RxAlamofire.framework", "${BUILT_PRODUCTS_DIR}/RxCocoa-iOS/RxCocoa.framework", "${BUILT_PRODUCTS_DIR}/RxSwift-iOS/RxSwift.framework", + "${BUILT_PRODUCTS_DIR}/SwiftDate-iOS/SwiftDate.framework", "${BUILT_PRODUCTS_DIR}/TableKit/TableKit.framework", "${BUILT_PRODUCTS_DIR}/UIScrollView-InfiniteScroll/UIScrollView_InfiniteScroll.framework", ); @@ -2342,6 +2386,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxAlamofire.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TableKit.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/UIScrollView_InfiniteScroll.framework", ); @@ -2396,6 +2441,7 @@ "${BUILT_PRODUCTS_DIR}/RxAlamofire-tvOS/RxAlamofire.framework", "${BUILT_PRODUCTS_DIR}/RxCocoa-tvOS/RxCocoa.framework", "${BUILT_PRODUCTS_DIR}/RxSwift-tvOS/RxSwift.framework", + "${BUILT_PRODUCTS_DIR}/SwiftDate-tvOS/SwiftDate.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -2405,6 +2451,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxAlamofire.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -2424,6 +2471,7 @@ "${BUILT_PRODUCTS_DIR}/RxAlamofire-iOS/RxAlamofire.framework", "${BUILT_PRODUCTS_DIR}/RxCocoa-iOS/RxCocoa.framework", "${BUILT_PRODUCTS_DIR}/RxSwift-iOS/RxSwift.framework", + "${BUILT_PRODUCTS_DIR}/SwiftDate-iOS/SwiftDate.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -2433,6 +2481,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxAlamofire.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftDate.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -2452,9 +2501,9 @@ 67EB7FF12061682F00BDD9FB /* TotalCountCursorListingResult+DefaultTotalCountCursorListingResult.swift in Sources */, 67EB8001206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, 67FD4382206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */, - 671462CC1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */, 6774529A20625E5B0024EEEF /* PaginationDataLoadingState.swift in Sources */, 678D26A020692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, + 6727478F206CD88600725163 /* DateFormattingService.swift in Sources */, 678D26A420692BFF00B05B93 /* TextFieldViewModelEvents.swift in Sources */, 671462801EB3396E00EAB194 /* AlamofireRequest+Extensions.swift in Sources */, 67EB7FF8206175F700BDD9FB /* PaginationWrappable.swift in Sources */, @@ -2470,9 +2519,9 @@ 6714634C1EB3396E00EAB194 /* ReuseIdentifierProtocol.swift in Sources */, 671462F01EB3396E00EAB194 /* UIImage+SupportExtensions.swift in Sources */, 67CAF8C620652E2A00527085 /* TextFieldViewModel.swift in Sources */, - 6771DFDE1EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */, 671462681EB3396E00EAB194 /* NetworkService.swift in Sources */, 671463101EB3396E00EAB194 /* UIViewController+DefaultXibName.swift in Sources */, + 67386A8C206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */, 674AF55C1EC45B1600038A8F /* UIActivityIndicatorView+LoadingIndicator.swift in Sources */, 671463401EB3396E00EAB194 /* ModuleConfigurator.swift in Sources */, 67A1FF8F1EBCA09B00D6C89F /* UIImage+Spinner.swift in Sources */, @@ -2482,7 +2531,6 @@ 67EB7FC0206140E600BDD9FB /* TotalCountCursor.swift in Sources */, 36DAAF512007CC920090BE0D /* UITableView+Extensions.swift in Sources */, 671463841EB3396E00EAB194 /* ResizeDrawingOperation.swift in Sources */, - 6771DFD81EE99EBA002DCDAE /* DateFormattingService.swift in Sources */, 6774528D20625C9E0024EEEF /* GeneralDataLoadingState.swift in Sources */, 671462D01EB3396E00EAB194 /* UIScrollView+Support.swift in Sources */, 671463901EB3396E00EAB194 /* TemplateDrawingOperation.swift in Sources */, @@ -2519,6 +2567,7 @@ 671463041EB3396E00EAB194 /* UIView+LoadingIndicator.swift in Sources */, 6774527420624E820024EEEF /* DataLoadingModel.swift in Sources */, 40F118491F8FF223004AADAF /* TableRow+AppearanceExtension.swift in Sources */, + 6727476E206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */, 671463701EB3396E00EAB194 /* ApiRequestParameters.swift in Sources */, 676B22A2206A626D002E9F8A /* NSAttributedString+Extensions.swift in Sources */, A658E5501F8CD9350093527A /* Array+SeparatorRowBoxExtensions.swift in Sources */, @@ -2526,17 +2575,20 @@ 671462EC1EB3396E00EAB194 /* UIImage+Extensions.swift in Sources */, 677452AE206274630024EEEF /* PaginationWrapper.swift in Sources */, A6E0DDF11F8A6C80002CA74E /* SeparatorConfiguration.swift in Sources */, + 6727477F206CD3BD00725163 /* ViewText+Extensions.swift in Sources */, 67EB7FEB2061667900BDD9FB /* DefaultTotalCountCursorListingResult.swift in Sources */, 671AD26C206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift in Sources */, 673CF4382063E7CE00C329F6 /* GeneralDataLoadingController+DefaultImplementation.swift in Sources */, 671AD267206A365100EAF887 /* UIApplication+OpenUrlSupport.swift in Sources */, 673CF40B2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */, 6714636C1EB3396E00EAB194 /* XibNameProtocol.swift in Sources */, + 67274772206CCF1200725163 /* ViewText.swift in Sources */, 6771DFEA1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */, 671462A01EB3396E00EAB194 /* Double+Rounding.swift in Sources */, 6714625C1EB3396E00EAB194 /* LogFormatter.swift in Sources */, 671463081EB3396E00EAB194 /* UIView+Rotation.swift in Sources */, 6714626C1EB3396E00EAB194 /* XibView.swift in Sources */, + 67274778206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */, 6774529220625D170024EEEF /* GeneralDataLoadingModel.swift in Sources */, 6714637C1EB3396E00EAB194 /* ImageDrawingOperation.swift in Sources */, 671463341EB3396E00EAB194 /* DrawingOperation.swift in Sources */, @@ -2546,6 +2598,7 @@ 671463A71EB340C000EAB194 /* UIViewController+ConfigurableController.swift in Sources */, 671463141EB3396E00EAB194 /* UIViewController+TopVisibleViewController.swift in Sources */, 6774527020624A2A0024EEEF /* PaginationWrapperDelegate+DefaultImplementation.swift in Sources */, + 6727478A206CD83600725163 /* DateFormat.swift in Sources */, 67745280206256A20024EEEF /* RxDataLoadingModel.swift in Sources */, A6F32C081F6EBDAA00AC08EE /* String+LocalizedComponent.swift in Sources */, 671462881EB3396E00EAB194 /* CGFloat+Pixels.swift in Sources */, @@ -2564,6 +2617,7 @@ 40F118471F8FEF97004AADAF /* AppearanceConfigurable.swift in Sources */, 671463181EB3396E00EAB194 /* UIWindow+Extensions.swift in Sources */, 671462541EB3396E00EAB194 /* App.swift in Sources */, + 67274769206CCC9D00725163 /* ViewBackground.swift in Sources */, 671463781EB3396E00EAB194 /* CALayerDrawingOperation.swift in Sources */, 6714632C1EB3396E00EAB194 /* ConfigurableController.swift in Sources */, 6714628C1EB3396E00EAB194 /* CGImage+Alpha.swift in Sources */, @@ -2578,6 +2632,7 @@ 671462501EB3396E00EAB194 /* StaticCursor.swift in Sources */, 67EB7FC7206148D000BDD9FB /* TotalCountCursorListingResult.swift in Sources */, 67745286206259CF0024EEEF /* Rx+RxDataSourceProtocol.swift in Sources */, + 67955D52206D216B0021ECD2 /* Singleton.swift in Sources */, 67EB7FE420615DE000BDD9FB /* DataSource.swift in Sources */, 67EB7FD420615D1700BDD9FB /* ResettableCursorType.swift in Sources */, 6714629C1EB3396E00EAB194 /* CursorType+Slice.swift in Sources */, @@ -2586,7 +2641,6 @@ 673CF4342063E29B00C329F6 /* TextWithButtonPlaceholder.swift in Sources */, 673CF4222063D90600C329F6 /* DisposeBagHolder.swift in Sources */, 671463681EB3396E00EAB194 /* ConfigurableView.swift in Sources */, - 6771DFE41EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2618,18 +2672,18 @@ 67EB7FE620615DE000BDD9FB /* DataSource.swift in Sources */, 6714634A1EB3396E00EAB194 /* ResettableType.swift in Sources */, 671462E61EB3396E00EAB194 /* UIColor+Hex.swift in Sources */, - 671462CE1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */, A676AE4D1F9810C1001F9214 /* Any+Cast.swift in Sources */, 67FD4384206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */, EFBE57D21EC35EF20040E00A /* Array+Extensions.swift in Sources */, + 6727478C206CD83600725163 /* DateFormat.swift in Sources */, 67EB7FC2206140E600BDD9FB /* TotalCountCursor.swift in Sources */, 671462821EB3396E00EAB194 /* AlamofireRequest+Extensions.swift in Sources */, 67745288206259CF0024EEEF /* Rx+RxDataSourceProtocol.swift in Sources */, 67E6C2371EBB32F5007842A6 /* SingleLoadCursor.swift in Sources */, 67CAF8B320651E1E00527085 /* ConfigurableNetworkService.swift in Sources */, 67CAF8B820651E4F00527085 /* ConfigurableNetworkService+DefaultImplementation.swift in Sources */, + 67274781206CD3BD00725163 /* ViewText+Extensions.swift in Sources */, 671463561EB3396E00EAB194 /* StaticViewHeightProtocol.swift in Sources */, - 6771DFE01EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */, 671463621EB3396E00EAB194 /* SupportProtocol.swift in Sources */, 6771DFEC1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */, 678D26A220692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, @@ -2660,9 +2714,9 @@ 6714627E1EB3396E00EAB194 /* AlamofireManager+Extensions.swift in Sources */, 677452AB206263360024EEEF /* CursorType+RxDataSourceDefaultImplementation.swift in Sources */, 673564F32068C2AD00F0CBED /* NumberFormattingService+DefaultImplementation.swift in Sources */, - 6771DFDA1EE99EBA002DCDAE /* DateFormattingService.swift in Sources */, 67EB7FD620615D1700BDD9FB /* ResettableCursorType.swift in Sources */, 6714625A1EB3396E00EAB194 /* Log.swift in Sources */, + 67274791206CD88600725163 /* DateFormattingService.swift in Sources */, 6714627A1EB3396E00EAB194 /* ResizeMode.swift in Sources */, 67CAF8C820652E2A00527085 /* TextFieldViewModel.swift in Sources */, 671463A41EB33FF600EAB194 /* Animatable.swift in Sources */, @@ -2674,7 +2728,9 @@ A676AE481F97D28A001F9214 /* String+Extensions.swift in Sources */, 673CF4242063D90600C329F6 /* DisposeBagHolder.swift in Sources */, 67C7B17B2068BB1C00C9EDA3 /* NumberFormattingService.swift in Sources */, + 67274774206CCF1200725163 /* ViewText.swift in Sources */, 671462A21EB3396E00EAB194 /* Double+Rounding.swift in Sources */, + 67955D54206D216B0021ECD2 /* Singleton.swift in Sources */, 67EB7FF32061682F00BDD9FB /* TotalCountCursorListingResult+DefaultTotalCountCursorListingResult.swift in Sources */, 6714625E1EB3396E00EAB194 /* LogFormatter.swift in Sources */, 67EB7FED2061667900BDD9FB /* DefaultTotalCountCursorListingResult.swift in Sources */, @@ -2682,6 +2738,7 @@ 671463361EB3396E00EAB194 /* DrawingOperation.swift in Sources */, 676B22A4206A626D002E9F8A /* NSAttributedString+Extensions.swift in Sources */, 671462721EB3396E00EAB194 /* CursorError.swift in Sources */, + 67386A8E206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */, 671462961EB3396E00EAB194 /* CGSize+CGContextSize.swift in Sources */, 671463661EB3396E00EAB194 /* ViewHeightProtocol.swift in Sources */, 67EB7FD120615B8900BDD9FB /* TotalCountCursorConfiguration.swift in Sources */, @@ -2689,7 +2746,6 @@ 673CF40D2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */, 67EB7FC9206148D000BDD9FB /* TotalCountCursorListingResult.swift in Sources */, 6774527620624E820024EEEF /* DataLoadingModel.swift in Sources */, - 6771DFE61EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */, 6714624A1EB3396E00EAB194 /* FixedPageCursor.swift in Sources */, 673564F82068C68D00F0CBED /* NumberFormat.swift in Sources */, 671462CA1EB3396E00EAB194 /* String+Localization.swift in Sources */, @@ -2718,10 +2774,12 @@ files = ( 6714634B1EB3396E00EAB194 /* ResettableType.swift in Sources */, 671462E71EB3396E00EAB194 /* UIColor+Hex.swift in Sources */, - 671462CF1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */, + 67274775206CCF1200725163 /* ViewText.swift in Sources */, + 6727476B206CCCA500725163 /* ViewBackground.swift in Sources */, 671462831EB3396E00EAB194 /* AlamofireRequest+Extensions.swift in Sources */, 677452B820627FE00024EEEF /* PaginationWrappable.swift in Sources */, 673CF40E2063AB7C00C329F6 /* GeneralDataLoadingViewModel.swift in Sources */, + 67274770206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */, 678D26A320692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, 67745283206256A20024EEEF /* RxDataLoadingModel.swift in Sources */, 67EB8003206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, @@ -2730,12 +2788,12 @@ 671462871EB3396E00EAB194 /* CGContext+Initializers.swift in Sources */, 6714634F1EB3396E00EAB194 /* ReuseIdentifierProtocol.swift in Sources */, 671462F31EB3396E00EAB194 /* UIImage+SupportExtensions.swift in Sources */, - 6771DFE71EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */, 6714626B1EB3396E00EAB194 /* NetworkService.swift in Sources */, 673CF43A2063E7CE00C329F6 /* GeneralDataLoadingController+DefaultImplementation.swift in Sources */, 671463131EB3396E00EAB194 /* UIViewController+DefaultXibName.swift in Sources */, 671463431EB3396E00EAB194 /* ModuleConfigurator.swift in Sources */, 671462931EB3396E00EAB194 /* CGImage+Crop.swift in Sources */, + 6727477A206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */, 67EB7FE720615DE000BDD9FB /* DataSource.swift in Sources */, 671462FF1EB3396E00EAB194 /* UIView+XibNameProtocol.swift in Sources */, 67FDC2621FA310EA00C76A77 /* RequestError.swift in Sources */, @@ -2750,6 +2808,7 @@ 671463271EB3396E00EAB194 /* Any+TypeName.swift in Sources */, 67EB7FD220615B8900BDD9FB /* TotalCountCursorConfiguration.swift in Sources */, 671AD26F206A3E8500EAF887 /* Array+TotalCountCursorListingResult.swift in Sources */, + 67955D55206D216B0021ECD2 /* Singleton.swift in Sources */, EFBE57D31EC35EF20040E00A /* Array+Extensions.swift in Sources */, 67FD4385206BD24B005B0C64 /* EqutableOptionalArray.swift in Sources */, 67CAF8AE2065189C00527085 /* NetworkService+ActivityIndicator.swift in Sources */, @@ -2768,15 +2827,16 @@ A676AE4F1F9810C1001F9214 /* Any+Cast.swift in Sources */, 671463031EB3396E00EAB194 /* UIView+LoadFromNib.swift in Sources */, 6714627F1EB3396E00EAB194 /* AlamofireManager+Extensions.swift in Sources */, - 6771DFDB1EE99EBA002DCDAE /* DateFormattingService.swift in Sources */, 6714625B1EB3396E00EAB194 /* Log.swift in Sources */, 6714627B1EB3396E00EAB194 /* ResizeMode.swift in Sources */, 67745289206259CF0024EEEF /* Rx+RxDataSourceProtocol.swift in Sources */, + 67386A8F206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */, 671463071EB3396E00EAB194 /* UIView+LoadingIndicator.swift in Sources */, 6774526E206249E30024EEEF /* UICollectionView+PaginationWrappable.swift in Sources */, 6771DFED1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */, 671463A91EB340C000EAB194 /* UIViewController+ConfigurableController.swift in Sources */, 673564F92068C68D00F0CBED /* NumberFormat.swift in Sources */, + 67274792206CD88600725163 /* DateFormattingService.swift in Sources */, A676AE581F981131001F9214 /* ObservableMappable.swift in Sources */, 671463731EB3396E00EAB194 /* ApiRequestParameters.swift in Sources */, 671462EF1EB3396E00EAB194 /* UIImage+Extensions.swift in Sources */, @@ -2795,14 +2855,15 @@ 6714637F1EB3396E00EAB194 /* ImageDrawingOperation.swift in Sources */, 67EB7FD720615D1700BDD9FB /* ResettableCursorType.swift in Sources */, 671463371EB3396E00EAB194 /* DrawingOperation.swift in Sources */, + 67274782206CD3BD00725163 /* ViewText+Extensions.swift in Sources */, 673CF42E2063DE5900C329F6 /* TextPlaceholderView.swift in Sources */, 671462731EB3396E00EAB194 /* CursorError.swift in Sources */, + 6727478D206CD83600725163 /* DateFormat.swift in Sources */, 67EB7FDD20615D5B00BDD9FB /* ResettableRxCursorDataSource.swift in Sources */, 677452A720625FA90024EEEF /* RxDataSource.swift in Sources */, 6774527720624E820024EEEF /* DataLoadingModel.swift in Sources */, 678D267C20691D8200B05B93 /* DataModelFieldBinding.swift in Sources */, 6714639B1EB3396E00EAB194 /* AnyLoadingIndicator.swift in Sources */, - 6771DFE11EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */, 671463171EB3396E00EAB194 /* UIViewController+TopVisibleViewController.swift in Sources */, 678D26A720692BFF00B05B93 /* TextFieldViewModelEvents.swift in Sources */, 67EB7FCA206148D000BDD9FB /* TotalCountCursorListingResult.swift in Sources */, @@ -2866,14 +2927,14 @@ 678D267A20691D8200B05B93 /* DataModelFieldBinding.swift in Sources */, 67EB7FE520615DE000BDD9FB /* DataSource.swift in Sources */, 671463491EB3396E00EAB194 /* ResettableType.swift in Sources */, + 67386A8D206CF3F6004EDA6C /* DateFormattingService+DefaultImplementation.swift in Sources */, A676AE491F97D28A001F9214 /* String+Extensions.swift in Sources */, 671462E51EB3396E00EAB194 /* UIColor+Hex.swift in Sources */, 67EB7FFE206176C900BDD9FB /* AnyPaginationWrappable.swift in Sources */, - 671462CD1EB3396E00EAB194 /* String+SizeCalculation.swift in Sources */, + 67274773206CCF1200725163 /* ViewText.swift in Sources */, 678D26A520692BFF00B05B93 /* TextFieldViewModelEvents.swift in Sources */, 677452B720627FE00024EEEF /* PaginationWrappable.swift in Sources */, 67EB7FC1206140E600BDD9FB /* TotalCountCursor.swift in Sources */, - 6771DFDF1EE99F6F002DCDAE /* DateFormattingArguments.swift in Sources */, 6771DFEB1EEA7CB8002DCDAE /* DateFormattingService+MappingTransform.swift in Sources */, 67A1FF951EBCA65E00D6C89F /* CABasicAnimation+Rotation.swift in Sources */, 671462811EB3396E00EAB194 /* AlamofireRequest+Extensions.swift in Sources */, @@ -2901,6 +2962,7 @@ 671463911EB3396E00EAB194 /* TemplateDrawingOperation.swift in Sources */, 67EB7FEC2061667900BDD9FB /* DefaultTotalCountCursorListingResult.swift in Sources */, 671462991EB3396E00EAB194 /* CGSize+Resize.swift in Sources */, + 67274780206CD3BD00725163 /* ViewText+Extensions.swift in Sources */, 671463311EB3396E00EAB194 /* CursorType.swift in Sources */, 6714624D1EB3396E00EAB194 /* MapCursor.swift in Sources */, 67EB7FD520615D1700BDD9FB /* ResettableCursorType.swift in Sources */, @@ -2919,6 +2981,7 @@ 671462591EB3396E00EAB194 /* Log.swift in Sources */, 673CF4352063E29B00C329F6 /* TextWithButtonPlaceholder.swift in Sources */, 67EB8002206177D600BDD9FB /* PaginationWrapperDelegate.swift in Sources */, + 6727476F206CCDDB00725163 /* ViewBackground+Configuration.swift in Sources */, 673CF4232063D90600C329F6 /* DisposeBagHolder.swift in Sources */, 677452AA206263360024EEEF /* CursorType+RxDataSourceDefaultImplementation.swift in Sources */, 671462791EB3396E00EAB194 /* ResizeMode.swift in Sources */, @@ -2943,7 +3006,8 @@ 671463151EB3396E00EAB194 /* UIViewController+TopVisibleViewController.swift in Sources */, 671462891EB3396E00EAB194 /* CGFloat+Pixels.swift in Sources */, 674AF55D1EC45B1600038A8F /* UIActivityIndicatorView+LoadingIndicator.swift in Sources */, - 6771DFD91EE99EBA002DCDAE /* DateFormattingService.swift in Sources */, + 67274790206CD88600725163 /* DateFormattingService.swift in Sources */, + 67955D53206D216B0021ECD2 /* Singleton.swift in Sources */, A676AE4E1F9810C1001F9214 /* Any+Cast.swift in Sources */, 671462951EB3396E00EAB194 /* CGSize+CGContextSize.swift in Sources */, 67EB7FF22061682F00BDD9FB /* TotalCountCursorListingResult+DefaultTotalCountCursorListingResult.swift in Sources */, @@ -2961,18 +3025,21 @@ 673CF4122063ABD100C329F6 /* GeneralDataLoadingState+Extensions.swift in Sources */, 6714633D1EB3396E00EAB194 /* LoadingIndicator.swift in Sources */, 671463191EB3396E00EAB194 /* UIWindow+Extensions.swift in Sources */, + 6727478B206CD83600725163 /* DateFormat.swift in Sources */, EFBE57DC1EC361620040E00A /* UIView+Layout.swift in Sources */, 671462551EB3396E00EAB194 /* App.swift in Sources */, 67A1FF901EBCA09B00D6C89F /* UIImage+Spinner.swift in Sources */, 6774529B20625E5B0024EEEF /* PaginationDataLoadingState.swift in Sources */, 67CAF8B220651E1E00527085 /* ConfigurableNetworkService.swift in Sources */, 671463791EB3396E00EAB194 /* CALayerDrawingOperation.swift in Sources */, + 6727476A206CCCA300725163 /* ViewBackground.swift in Sources */, 6714632D1EB3396E00EAB194 /* ConfigurableController.swift in Sources */, 67745287206259CF0024EEEF /* Rx+RxDataSourceProtocol.swift in Sources */, A676AE561F98112F001F9214 /* ObservableMappable.swift in Sources */, 6774527A206252020024EEEF /* DataLoadingState.swift in Sources */, 6714628D1EB3396E00EAB194 /* CGImage+Alpha.swift in Sources */, 67745269206249360024EEEF /* UITableView+PaginationWrappable.swift in Sources */, + 67274779206CD0B500725163 /* UILabel+ViewTextConfiguration.swift in Sources */, 67EB7FC8206148D000BDD9FB /* TotalCountCursorListingResult.swift in Sources */, 671462751EB3396E00EAB194 /* LeadKitError.swift in Sources */, EFBE57D11EC35EF20040E00A /* Array+Extensions.swift in Sources */, @@ -2981,7 +3048,6 @@ 6714638D1EB3396E00EAB194 /* SolidFillDrawingOperation.swift in Sources */, 671463A31EB33FF600EAB194 /* Animatable.swift in Sources */, 678D26A120692BFF00B05B93 /* TextFieldViewEvents.swift in Sources */, - 6771DFE51EE9A00A002DCDAE /* DateFormattingArguments+DateFormatter.swift in Sources */, 671462511EB3396E00EAB194 /* StaticCursor.swift in Sources */, 67CAF8B720651E4F00527085 /* ConfigurableNetworkService+DefaultImplementation.swift in Sources */, 6714629D1EB3396E00EAB194 /* CursorType+Slice.swift in Sources */, diff --git a/Podfile b/Podfile index 5d3e755c..b4d53a27 100644 --- a/Podfile +++ b/Podfile @@ -5,6 +5,7 @@ abstract_target 'LeadKit' do pod "RxAlamofire", '~> 4.1' pod "ObjectMapper", '~> 3.0' pod "SwiftLint", '~> 0.25' + pod "SwiftDate", '~> 4.5' inhibit_all_warnings! diff --git a/Podfile.lock b/Podfile.lock index 9d21ddef..1073d0d8 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -12,6 +12,7 @@ PODS: - RxCocoa (4.1.2): - RxSwift (~> 4.0) - RxSwift (4.1.2) + - SwiftDate (4.5.1) - SwiftLint (0.25.0) - TableKit (2.6.0) - UIScrollView-InfiniteScroll (1.0.2) @@ -22,6 +23,7 @@ DEPENDENCIES: - RxAlamofire (~> 4.1) - RxCocoa (~> 4.1) - RxSwift (~> 4.1) + - SwiftDate (~> 4.5) - SwiftLint (~> 0.25) - TableKit (~> 2.6) - UIScrollView-InfiniteScroll (~> 1.0.0) @@ -33,10 +35,11 @@ SPEC CHECKSUMS: RxAlamofire: 96a2bff4694a1609bb59c57b53d99ea7a0ddc64a RxCocoa: d88ba0f1f6abf040011a9eb4b539324fc426843a RxSwift: e49536837d9901277638493ea537394d4b55f570 + SwiftDate: 7b56d42a221f582047287deb256b23fc5ed49a60 SwiftLint: e14651157288e9e01d6e1a71db7014fb5744a8ea TableKit: 61880e4c13ac0ba396a308fcb1ae48f6dec8b458 UIScrollView-InfiniteScroll: c132d6d5851daff229ab4a1060ccf70a05a051c9 -PODFILE CHECKSUM: ab838edfaeaa5ec185764a2fa042a9b61be1da2a +PODFILE CHECKSUM: a266374cd31534965884702e73d8360ce3cdd274 COCOAPODS: 1.4.0 diff --git a/Sources/Classes/Services/DateFormattingService.swift b/Sources/Classes/Services/DateFormattingService.swift deleted file mode 100644 index 8e7cbdf4..00000000 --- a/Sources/Classes/Services/DateFormattingService.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// Copyright (c) 2017 Touch Instinct -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the Software), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// Date formatting service. Used for date to string and string to date formatting. -/// Takes into account locale and timezone. -open class DateFormattingService { - - private var dateFormatters: [DateFormattingArguments: DateFormatter] = [:] - - public init(formattingArguments: [DateFormattingArguments] = []) { - for argument in formattingArguments { - register(arguments: argument) - } - } - - /// DateFormatter registration method. - /// - /// - Parameter arguments: A formatting arguments structure. - public func register(arguments: DateFormattingArguments) { - dateFormatters[arguments] = arguments.dateFormatter - } - - /// String to date convertion method. - /// - /// - Parameters: - /// - dateString: The string to parse. - /// - arguments: A formatting arguments structure. - /// - Returns: A date representation of a given string interpreted using given arguments. - public func date(from dateString: String, arguments: DateFormattingArguments) -> Date? { - guard let dateFormatter = dateFormatters[arguments] else { - fatalError("No date formatter registered for given arguments: \(arguments)") - } - - return dateFormatter.date(from: dateString) - } - - /// Date to string convertion method. - /// - /// - Parameters: - /// - date: The date to format. - /// - arguments: A formatting arguments structure. - /// - Returns: A string representation of a given date formatted using given arguments. - public func string(from date: Date, arguments: DateFormattingArguments) -> String? { - guard let dateFormatter = dateFormatters[arguments] else { - fatalError("No date formatter registered for given arguments: \(arguments)") - } - - return dateFormatter.string(from: date) - } - -} diff --git a/Sources/Extensions/DateFormattingArguments/DateFormattingArguments+DateFormatter.swift b/Sources/Enums/Views/ViewBackground.swift similarity index 67% rename from Sources/Extensions/DateFormattingArguments/DateFormattingArguments+DateFormatter.swift rename to Sources/Enums/Views/ViewBackground.swift index 821993da..6d13dfc8 100644 --- a/Sources/Extensions/DateFormattingArguments/DateFormattingArguments+DateFormatter.swift +++ b/Sources/Enums/Views/ViewBackground.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// Copyright (c) 2018 Touch Instinct // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the Software), to deal @@ -20,25 +20,15 @@ // THE SOFTWARE. // -import Foundation +import UIKit -public extension DateFormattingArguments { +/// Enum that describes possible view backgrounds. +/// +/// - color: Solid color background. +/// - image: Image background. +public enum ViewBackground { - /// Date formatter for formatting arguments. - var dateFormatter: DateFormatter { - return DateFormatter(dateFormat: dateFormat, locale: locale, timeZone: timeZone) - } - -} - -private extension DateFormatter { - - convenience init(dateFormat: String, locale: Locale, timeZone: TimeZone) { - self.init() - - self.dateFormat = dateFormat - self.locale = locale - self.timeZone = timeZone - } + case color(UIColor) + case image(UIImage) } diff --git a/Sources/Enums/Views/ViewText.swift b/Sources/Enums/Views/ViewText.swift new file mode 100644 index 00000000..94992f19 --- /dev/null +++ b/Sources/Enums/Views/ViewText.swift @@ -0,0 +1,34 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import UIKit + +/// Enum that describes text with appearance options. +/// +/// - string: Regular string with common and often-used text attributes. +/// - attributedString: Attributed string. +public enum ViewText { + + case string(String, font: UIFont, color: UIColor, alignment: NSTextAlignment) + case attributedString(NSAttributedString) + +} diff --git a/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift b/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift new file mode 100644 index 00000000..6c6347f5 --- /dev/null +++ b/Sources/Extensions/DateFormattingService/DateFormattingService+DefaultImplementation.swift @@ -0,0 +1,81 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import SwiftDate + +public extension DateFormattingService { + + func date(from string: String, + format: DateFormatType, + defaultDate: DateInRegion = Date().inRegion()) -> DateInRegion { + + return date(from: string, format: format) ?? defaultDate + } + + func date(from string: String, format: DateFormatType) -> DateInRegion? { + return DateInRegion(string: string, format: format.swiftDateFormat, fromRegion: currentRegion) + } + + func string(from date: DateInRegion, format: DateFormatType) -> String { + return date.string(format: format.swiftDateFormat) + } + +} + +public extension DateFormattingService where Self: Singleton { + + /// Method parses date from string in given format with current region. + /// If parsing fails - it returns default date in region. + /// + /// - Parameters: + /// - string: String to use for date parsing. + /// - format: Format that should be used for date parsing. + /// - defaultDate: Default date if formatting will fail. + /// - Returns: Date parsed from given string or default date if parsing did fail. + static func date(from string: String, + format: DateFormatType, + defaultDate: DateInRegion = Date().inRegion()) -> DateInRegion { + + return shared.date(from: string, format: format, defaultDate: defaultDate) + } + + /// Method parses date from string in given format with current region. + /// + /// - Parameters: + /// - string: String to use for date parsing. + /// - format: Format that should be used for date parsing. + /// - Returns: Date parsed from given string or default date if parsing did fail. + static func date(from string: String, format: DateFormatType) -> DateInRegion? { + return shared.date(from: string, format: format) + } + + /// Method format date in given format. + /// + /// - Parameters: + /// - date: Date to format. + /// - format: Format that should be used for date formatting. + /// - Returns: String that contains formatted date or nil if formatting did fail. + static func string(from date: DateInRegion, format: DateFormatType) -> String { + return shared.string(from: date, format: format) + } + +} diff --git a/Sources/Extensions/DateFormattingService/DateFormattingService+MappingTransform.swift b/Sources/Extensions/DateFormattingService/DateFormattingService+MappingTransform.swift index c2f18304..975118fa 100644 --- a/Sources/Extensions/DateFormattingService/DateFormattingService+MappingTransform.swift +++ b/Sources/Extensions/DateFormattingService/DateFormattingService+MappingTransform.swift @@ -21,6 +21,7 @@ // import ObjectMapper +import SwiftDate public extension DateFormattingService { @@ -28,16 +29,16 @@ public extension DateFormattingService { /// /// - Parameter arguments: A formatting arguments structure. /// - Returns: A transform for given formatting arguments. - func mappingTransform(for arguments: DateFormattingArguments) -> TransformOf { - return TransformOf(fromJSON: { stringValue in + func mappingTransform(with format: DateFormatType) -> TransformOf { + return TransformOf(fromJSON: { stringValue in if let stringValue = stringValue { - return self.date(from: stringValue, arguments: arguments) + return self.date(from: stringValue, format: format) } else { return nil } }, toJSON: { dateValue in if let dateValue = dateValue { - return self.string(from: dateValue, arguments: arguments) + return self.string(from: dateValue, format: format) } else { return nil } @@ -45,3 +46,15 @@ public extension DateFormattingService { } } + +public extension DateFormattingService where Self: Singleton { + + /// Creates transform for date to string and string to date mapping. + /// + /// - Parameter arguments: A formatting arguments structure. + /// - Returns: A transform for given formatting arguments. + static func mappingTransform(with format: DateFormatType) -> TransformOf { + return shared.mappingTransform(with: format) + } + +} diff --git a/Sources/Extensions/String/String+SizeCalculation.swift b/Sources/Extensions/String/String+SizeCalculation.swift deleted file mode 100644 index a7224c44..00000000 --- a/Sources/Extensions/String/String+SizeCalculation.swift +++ /dev/null @@ -1,82 +0,0 @@ -// -// Copyright (c) 2017 Touch Instinct -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import UIKit - -/** - * Struct for holding result of string size calculation - */ -public struct StringSizeCalculationResult { - - public let size: CGSize - public let fontLineHeight: CGFloat? - -} - -public extension StringSizeCalculationResult { - - var height: CGFloat { return size.height } - - var width: CGFloat { return size.width } - - var numberOfLines: UInt? { - if let lineHeight = fontLineHeight { - let lineHeightRounded = Double(lineHeight).roundValue(withPersicion: 2) - - let heightRounded = Double(height).roundValue(withPersicion: 2) - - let numberOfLines = ceil(heightRounded / lineHeightRounded) - - return UInt(numberOfLines) - } - - return nil - } - -} - -public extension String { - - /** - method which calculates string size based on given character attributes and (optional) max width and height - - - parameter attributes: dictionary with string character attributes - - parameter maxWidth: maximum width of text - - parameter maxHeight: maximum height of text - - - returns: string size calculation result - */ - func size(withAttributes attributes: [NSAttributedStringKey: AnyObject]?, - maxWidth: CGFloat = CGFloat.greatestFiniteMagnitude, - maxHeight: CGFloat = CGFloat.greatestFiniteMagnitude) -> StringSizeCalculationResult { - - let size = self.boundingRect(with: CGSize(width: maxWidth, height: maxHeight), - options: [.usesLineFragmentOrigin, .usesFontLeading], - attributes: attributes, - context: nil).size - - let fontLineHeight = (attributes?[NSAttributedStringKey.font] as? UIFont)?.lineHeight - - return StringSizeCalculationResult(size: size, fontLineHeight: fontLineHeight) - } - -} diff --git a/Sources/Extensions/Views/UILabel/UILabel+ViewTextConfiguration.swift b/Sources/Extensions/Views/UILabel/UILabel+ViewTextConfiguration.swift new file mode 100644 index 00000000..a8adc1c9 --- /dev/null +++ b/Sources/Extensions/Views/UILabel/UILabel+ViewTextConfiguration.swift @@ -0,0 +1,42 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import UIKit.UILabel + +public extension UILabel { + + /// Configures label with given ViewText. + /// + /// - Parameter viewText: ViewText to set. + func configure(with viewText: ViewText) { + switch viewText { + case .string(let string, let font, let color, let alignment): + self.font = font + self.textColor = color + self.textAlignment = alignment + self.text = string + case .attributedString(let attributedString): + attributedText = attributedString + } + } + +} diff --git a/Sources/Structures/DateFormatting/DateFormattingArguments.swift b/Sources/Extensions/Views/ViewBackground+Configuration.swift similarity index 51% rename from Sources/Structures/DateFormatting/DateFormattingArguments.swift rename to Sources/Extensions/Views/ViewBackground+Configuration.swift index 7d8d7e06..86192c41 100644 --- a/Sources/Structures/DateFormatting/DateFormattingArguments.swift +++ b/Sources/Extensions/Views/ViewBackground+Configuration.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2017 Touch Instinct +// Copyright (c) 2018 Touch Instinct // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the Software), to deal @@ -20,38 +20,24 @@ // THE SOFTWARE. // -import Foundation +import UIKit -/// Structure describes "context" for date formatting. -public struct DateFormattingArguments: Hashable { +public extension ViewBackground { - let dateFormat: String - let locale: Locale - let timeZone: TimeZone - - /// Default initializer + /// Configures view subviews to current background. /// /// - Parameters: - /// - dateFormat: Date format to be used for formatting. - /// - locale: Locale to be used for formatting. - /// - timeZone: Time zone to be used for formatting. - public init(dateFormat: String, - locale: Locale = Locale.current, - timeZone: TimeZone = TimeZone.current) { - - self.dateFormat = dateFormat - self.locale = locale - self.timeZone = timeZone - } - - public var hashValue: Int { - return dateFormat.hashValue ^ locale.hashValue ^ timeZone.hashValue - } - - public static func == (lhs: DateFormattingArguments, rhs: DateFormattingArguments) -> Bool { - return lhs.dateFormat == rhs.dateFormat && - lhs.locale.identifier == rhs.locale.identifier && - lhs.timeZone.identifier == rhs.timeZone.identifier + /// - backgroundView: Background view that should be used in case of solid color. + /// - backgroundImageView: Background image view that should be used in case of background image. + func configure(backgroundView: UIView, backgroundImageView: UIImageView) { + switch self { + case .color(let color): + backgroundView.backgroundColor = color + backgroundImageView.image = nil + case .image(let image): + backgroundView.backgroundColor = nil + backgroundImageView.image = image + } } } diff --git a/Sources/Extensions/Views/ViewText+Extensions.swift b/Sources/Extensions/Views/ViewText+Extensions.swift new file mode 100644 index 00000000..98142bed --- /dev/null +++ b/Sources/Extensions/Views/ViewText+Extensions.swift @@ -0,0 +1,71 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import UIKit + +public extension ViewText { + + /// Convenient initializer for .string case with default alignment parameter. + /// + /// - Parameters: + /// - string: Text to use. + /// - font: Font to use. + /// - color: Color to use. + /// - alignment: Alignment to use. Default is natural. + init(string: String, font: UIFont, color: UIColor, alignment: NSTextAlignment = .natural) { + self = .string(string, font: font, color: color, alignment: alignment) + } + + /// Attributed string created using text attributes. + var attributedString: NSAttributedString { + switch self { + case .string(let title, let font, let color, let alignment): + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.alignment = alignment + + let attributes: [NSAttributedStringKey: Any] = [ + .font: font, + .foregroundColor: color, + .paragraphStyle: paragraphStyle + ] + + return NSAttributedString(string: title, attributes: attributes) + case .attributedString(let attributedTitle): + return attributedTitle + } + } + + /// Method that calculates size of view text using given max width and height arguments. + /// + /// - Parameters: + /// - maxWidth: The width constraint to apply when computing the string’s bounding rectangle. + /// - maxHeight: The width constraint to apply when computing the string’s bounding rectangle. + /// - Returns: Returns the size required to draw the text. + func size(maxWidth: CGFloat = CGFloat.greatestFiniteMagnitude, + maxHeight: CGFloat = CGFloat.greatestFiniteMagnitude) -> CGSize { + + return attributedString.boundingRect(with: CGSize(width: maxWidth, height: maxHeight), + options: [.usesLineFragmentOrigin, .usesFontLeading], + context: nil).size + } + +} diff --git a/Sources/Protocols/DateFormatingService/DateFormat.swift b/Sources/Protocols/DateFormatingService/DateFormat.swift new file mode 100644 index 00000000..01a7768a --- /dev/null +++ b/Sources/Protocols/DateFormatingService/DateFormat.swift @@ -0,0 +1,31 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import SwiftDate + +/// Protocol for describing date format. +public protocol DateFormat { + + /// SwiftDate.DateFormat for current format. + var swiftDateFormat: SwiftDate.DateFormat { get } + +} diff --git a/Sources/Protocols/DateFormatingService/DateFormattingService.swift b/Sources/Protocols/DateFormatingService/DateFormattingService.swift new file mode 100644 index 00000000..cb23296c --- /dev/null +++ b/Sources/Protocols/DateFormatingService/DateFormattingService.swift @@ -0,0 +1,59 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import SwiftDate + +/// Protocol that contains number formatting functions for often used number types. +public protocol DateFormattingService { + + associatedtype DateFormatType: DateFormat + + /// Region that will be used for parsing and formatting. + var currentRegion: Region { get } + + /// Method parses date from string in given format with current region. + /// If parsing fails - it returns default date in region. + /// + /// - Parameters: + /// - string: String to use for date parsing. + /// - format: Format that should be used for date parsing. + /// - defaultDate: Default date if formatting will fail. + /// - Returns: Date parsed from given string or default date if parsing did fail. + func date(from string: String, format: DateFormatType, defaultDate: DateInRegion) -> DateInRegion + + /// Method parses date from string in given format with current region. + /// + /// - Parameters: + /// - string: String to use for date parsing. + /// - format: Format that should be used for date parsing. + /// - Returns: Date parsed from given string or default date if parsing did fail. + func date(from string: String, format: DateFormatType) -> DateInRegion? + + /// Method format date in given format. + /// + /// - Parameters: + /// - date: Date to format. + /// - format: Format that should be used for date formatting. + /// - Returns: String that contains formatted date or nil if formatting did fail. + func string(from date: DateInRegion, format: DateFormatType) -> String + +} diff --git a/Sources/Protocols/Singleton.swift b/Sources/Protocols/Singleton.swift new file mode 100644 index 00000000..948ff07d --- /dev/null +++ b/Sources/Protocols/Singleton.swift @@ -0,0 +1,29 @@ +// +// Copyright (c) 2018 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +/// Protocol that describes type with single instance across the app. +public protocol Singleton { + + /// Shared instance of this type. + static var shared: Self { get } + +} From 8f16df4e9129d1f337b480808ba06394275862d4 Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Thu, 29 Mar 2018 17:42:54 +0300 Subject: [PATCH 2/7] fix watchOS build --- LeadKit.podspec | 1 + 1 file changed, 1 insertion(+) diff --git a/LeadKit.podspec b/LeadKit.podspec index e9c9c4f9..86bced82 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -70,6 +70,7 @@ Pod::Spec.new do |s| "Sources/Extensions/UIViewController/*", "Sources/Extensions/UIWindow/*", "Sources/Extensions/Views/UILabel/*", + "Sources/Extensions/Views/ViewBackground+Configuration.swift", "Sources/Protocols/LoadingIndicator.swift", "Sources/Protocols/DataLoading/PaginationDataLoading/PaginationWrappable.swift", "Sources/Protocols/DataLoading/GeneralDataLoading/GeneralDataLoadingController.swift", From 934121690df43f2eba26498f62a9c1c3bf7cd40e Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Thu, 29 Mar 2018 19:22:46 +0300 Subject: [PATCH 3/7] Safe area support added --- Sources/Extensions/UIView/UIView+Layout.swift | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/Sources/Extensions/UIView/UIView+Layout.swift b/Sources/Extensions/UIView/UIView+Layout.swift index f8bdefe8..910b41be 100644 --- a/Sources/Extensions/UIView/UIView+Layout.swift +++ b/Sources/Extensions/UIView/UIView+Layout.swift @@ -47,15 +47,46 @@ public extension UIView { widthAnchor.constraint(equalToConstant: size.width).isActive = true } + func setToCenter(wtih insets: UIEdgeInsets = .zero) { + guard let superview = superview else { + return + } + + translatesAutoresizingMaskIntoConstraints = false + + if #available(iOS 11, *) { + topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor, + constant: insets.top).isActive = true + leadingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leadingAnchor, + constant: insets.left).isActive = true + bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor, + constant: -insets.bottom).isActive = true + trailingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.trailingAnchor, + constant: -insets.right).isActive = true + } else { + topAnchor.constraint(equalTo: superview.topAnchor, constant: insets.top).isActive = true + leadingAnchor.constraint(equalTo: superview.leadingAnchor, constant: insets.left).isActive = true + bottomAnchor.constraint(equalTo: superview.bottomAnchor, constant: -insets.bottom).isActive = true + trailingAnchor.constraint(equalTo: superview.trailingAnchor, constant: -insets.right).isActive = true + } + } + private func scaleToFill() { guard let superview = superview else { return } - topAnchor.constraint(equalTo: superview.topAnchor).isActive = true - bottomAnchor.constraint(equalTo: superview.bottomAnchor).isActive = true - leftAnchor.constraint(equalTo: superview.leftAnchor).isActive = true - rightAnchor.constraint(equalTo: superview.rightAnchor).isActive = true + if #available(iOS 11, *) { + topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor).isActive = true + bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor).isActive = true + leftAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leftAnchor).isActive = true + rightAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.rightAnchor).isActive = true + } else { + topAnchor.constraint(equalTo: superview.topAnchor).isActive = true + bottomAnchor.constraint(equalTo: superview.bottomAnchor).isActive = true + leftAnchor.constraint(equalTo: superview.leftAnchor).isActive = true + rightAnchor.constraint(equalTo: superview.rightAnchor).isActive = true + } } } From e296f5ee77080d5a541626faec344b88cf03ebff Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Thu, 29 Mar 2018 19:52:30 +0300 Subject: [PATCH 4/7] Comment added --- Sources/Extensions/UIView/UIView+Layout.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/Extensions/UIView/UIView+Layout.swift b/Sources/Extensions/UIView/UIView+Layout.swift index 910b41be..bda42bf2 100644 --- a/Sources/Extensions/UIView/UIView+Layout.swift +++ b/Sources/Extensions/UIView/UIView+Layout.swift @@ -47,7 +47,12 @@ public extension UIView { widthAnchor.constraint(equalToConstant: size.width).isActive = true } - func setToCenter(wtih insets: UIEdgeInsets = .zero) { + /** + Place and fix view to parent view's center with insets + + - parameter insets: desired view insets, by default is zero + */ + func setToCenter(wtihInsets insets: UIEdgeInsets = .zero) { guard let superview = superview else { return } From 9a4d934cc2727818d873bc1ad1fb5ae4369f176e Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Thu, 29 Mar 2018 20:00:13 +0300 Subject: [PATCH 5/7] Refactored --- Sources/Extensions/UIView/UIView+Layout.swift | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/Sources/Extensions/UIView/UIView+Layout.swift b/Sources/Extensions/UIView/UIView+Layout.swift index bda42bf2..7a75bc2c 100644 --- a/Sources/Extensions/UIView/UIView+Layout.swift +++ b/Sources/Extensions/UIView/UIView+Layout.swift @@ -41,10 +41,14 @@ public extension UIView { return } - centerXAnchor.constraint(equalTo: parent.centerXAnchor).isActive = true - centerYAnchor.constraint(equalTo: parent.centerYAnchor).isActive = true - heightAnchor.constraint(equalToConstant: size.height).isActive = true - widthAnchor.constraint(equalToConstant: size.width).isActive = true + let constraints = [ + centerXAnchor.constraint(equalTo: parent.centerXAnchor), + centerYAnchor.constraint(equalTo: parent.centerYAnchor), + heightAnchor.constraint(equalToConstant: size.height), + widthAnchor.constraint(equalToConstant: size.width) + ] + + NSLayoutConstraint.activate(constraints) } /** @@ -59,21 +63,24 @@ public extension UIView { translatesAutoresizingMaskIntoConstraints = false + let constraints: [NSLayoutConstraint] if #available(iOS 11, *) { - topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor, - constant: insets.top).isActive = true - leadingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leadingAnchor, - constant: insets.left).isActive = true - bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor, - constant: -insets.bottom).isActive = true - trailingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.trailingAnchor, - constant: -insets.right).isActive = true + constraints = [ + topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor, constant: insets.top), + leadingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leadingAnchor, constant: insets.left), + bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor, constant: -insets.bottom), + trailingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.trailingAnchor, constant: -insets.right) + ] } else { - topAnchor.constraint(equalTo: superview.topAnchor, constant: insets.top).isActive = true - leadingAnchor.constraint(equalTo: superview.leadingAnchor, constant: insets.left).isActive = true - bottomAnchor.constraint(equalTo: superview.bottomAnchor, constant: -insets.bottom).isActive = true - trailingAnchor.constraint(equalTo: superview.trailingAnchor, constant: -insets.right).isActive = true + constraints = [ + topAnchor.constraint(equalTo: superview.topAnchor, constant: insets.top), + leadingAnchor.constraint(equalTo: superview.leadingAnchor, constant: insets.left), + bottomAnchor.constraint(equalTo: superview.bottomAnchor, constant: -insets.bottom), + trailingAnchor.constraint(equalTo: superview.trailingAnchor, constant: -insets.right) + ] } + + NSLayoutConstraint.activate(constraints) } private func scaleToFill() { @@ -81,17 +88,24 @@ public extension UIView { return } + let constraints: [NSLayoutConstraint] if #available(iOS 11, *) { - topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor).isActive = true - bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor).isActive = true - leftAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leftAnchor).isActive = true - rightAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.rightAnchor).isActive = true + constraints = [ + topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor), + bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor), + leftAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leftAnchor), + rightAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.rightAnchor) + ] } else { - topAnchor.constraint(equalTo: superview.topAnchor).isActive = true - bottomAnchor.constraint(equalTo: superview.bottomAnchor).isActive = true - leftAnchor.constraint(equalTo: superview.leftAnchor).isActive = true - rightAnchor.constraint(equalTo: superview.rightAnchor).isActive = true + constraints = [ + topAnchor.constraint(equalTo: superview.topAnchor), + bottomAnchor.constraint(equalTo: superview.bottomAnchor), + leftAnchor.constraint(equalTo: superview.leftAnchor), + rightAnchor.constraint(equalTo: superview.rightAnchor) + ] } + + NSLayoutConstraint.activate(constraints) } } From e6bdba0504e7cad51d4d16082b808075787d204f Mon Sep 17 00:00:00 2001 From: Ivan Smolin Date: Fri, 30 Mar 2018 12:19:27 +0300 Subject: [PATCH 6/7] Xcode 9.3 migration --- CHANGELOG.md | 2 ++ LeadKit.xcodeproj/project.pbxproj | 6 +++++- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Sources/Classes/DataLoading/Cursors/MapCursor.swift | 2 +- ...gurableNetworkService+DefaultImplementation.swift | 9 --------- .../TimeInterval/TimeInterval+DateComponents.swift | 12 ++++++------ Sources/Extensions/UIView/UIView+Layout.swift | 4 ++-- 7 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ff47f5..785d94ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ### 0.7.2 +- **Update**: Xcode 9.3 migration. +- **Remove**: Default initializer for Network service that conforms to `ConfigurableNetworkService` protocol. - **[Breaking Change]**: `DateFormattingService` class replaced with protocol. - **Add**: `SwiftDate` dependency for `DateFormattingService`. - **Add**: `ViewBackground` enum that describes possible view backgrounds. diff --git a/LeadKit.xcodeproj/project.pbxproj b/LeadKit.xcodeproj/project.pbxproj index ec752313..f40506fc 100644 --- a/LeadKit.xcodeproj/project.pbxproj +++ b/LeadKit.xcodeproj/project.pbxproj @@ -1930,7 +1930,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Touch Instinct"; TargetAttributes = { 67186B271EB248F100CFAFFB = { @@ -3426,12 +3426,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -3482,12 +3484,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/LeadKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Sources/Classes/DataLoading/Cursors/MapCursor.swift b/Sources/Classes/DataLoading/Cursors/MapCursor.swift index af29dff3..50cd45e6 100644 --- a/Sources/Classes/DataLoading/Cursors/MapCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/MapCursor.swift @@ -81,7 +81,7 @@ public class MapCursor: CursorType, RxDataSource { public func loadNextBatch() -> Single<[T]> { return cursor.loadNextBatch().map { newItems in - let transformedNewItems = newItems.flatMap(self.transform) + let transformedNewItems = newItems.compactMap(self.transform) self.elements += transformedNewItems return transformedNewItems diff --git a/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift b/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift index 5281bd61..b03fe381 100644 --- a/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift +++ b/Sources/Extensions/NetworkService/ConfigurableNetworkService+DefaultImplementation.swift @@ -52,12 +52,3 @@ public extension ConfigurableNetworkService { } } - -public extension ConfigurableNetworkService where Self: NetworkService { - - /// Convenience initializer with default session manager. - init() { - self.init(sessionManager: Self.sessionManager) - } - -} diff --git a/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift b/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift index 19049873..5b260f5d 100644 --- a/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift +++ b/Sources/Extensions/TimeInterval/TimeInterval+DateComponents.swift @@ -67,14 +67,14 @@ extension TimeInterval { Supported components: days, hours, minutes, seconds */ public var timeComponents: TimeComponents { - var ti = Int(self) - let days = (ti / TimeInterval.secondsInDay) % TimeInterval.secondsInDay - ti -= days * TimeInterval.secondsInDay + var timeInterval = Int(self) + let days = (timeInterval / TimeInterval.secondsInDay) % TimeInterval.secondsInDay + timeInterval -= days * TimeInterval.secondsInDay return ( days, - (ti / TimeInterval.secondsInHour) % TimeInterval.secondsInHour, - (ti / TimeInterval.secondsInMinute) % TimeInterval.secondsInMinute, - ti % TimeInterval.secondsInMinute + (timeInterval / TimeInterval.secondsInHour) % TimeInterval.secondsInHour, + (timeInterval / TimeInterval.secondsInMinute) % TimeInterval.secondsInMinute, + timeInterval % TimeInterval.secondsInMinute ) } diff --git a/Sources/Extensions/UIView/UIView+Layout.swift b/Sources/Extensions/UIView/UIView+Layout.swift index 7a75bc2c..359487e8 100644 --- a/Sources/Extensions/UIView/UIView+Layout.swift +++ b/Sources/Extensions/UIView/UIView+Layout.swift @@ -64,7 +64,7 @@ public extension UIView { translatesAutoresizingMaskIntoConstraints = false let constraints: [NSLayoutConstraint] - if #available(iOS 11, *) { + if #available(iOS 11, tvOS 11, *) { constraints = [ topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor, constant: insets.top), leadingAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.leadingAnchor, constant: insets.left), @@ -89,7 +89,7 @@ public extension UIView { } let constraints: [NSLayoutConstraint] - if #available(iOS 11, *) { + if #available(iOS 11, tvOS 11, *) { constraints = [ topAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.topAnchor), bottomAnchor.constraint(equalTo: superview.safeAreaLayoutGuide.bottomAnchor), From 35d81b0e2e265778955e4748adf7e0ac0436b642 Mon Sep 17 00:00:00 2001 From: Alexey Gerasimov Date: Fri, 30 Mar 2018 19:44:19 +0300 Subject: [PATCH 7/7] Podspec version fix --- LeadKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LeadKit.podspec b/LeadKit.podspec index 86bced82..47cdfbf3 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "0.7.2" + s.version = "0.7.3" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0"