Merge pull request 'feature/async_single_value_storage_map_ui_settings' (#7) from feature/async_single_value_storage_map_ui_settings into master
Reviewed-on: #7
This commit is contained in:
commit
f50bb09ad8
|
|
@ -1,5 +1,12 @@
|
|||
# Changelog
|
||||
|
||||
### 1.46.0
|
||||
|
||||
- **Added**: `AsyncSingleValueStorage` and `SingleValueStorageAsyncWrapper<SingleValueStorage>` for async access to SingleValue storages wtih swift concurrency support
|
||||
- **Added**: `BaseMapUISettings` used to configure map view of different providers + user location icon rendering for yandex maps
|
||||
- **Added**: `UserLocationFetcher` helper that requests authorization and subscribes to user location updates
|
||||
- **Update**: add `DEVELOPMENT_INSTALL` support for all podspecs and fix playground compilation issues
|
||||
|
||||
### 1.45.0
|
||||
|
||||
- **Added**: `SingleValueStorage` implementations + `AppInstallLifetimeSingleValueStorage` for automatically removing keychain items on app reinstall.
|
||||
|
|
|
|||
|
|
@ -100,11 +100,22 @@ let package = Package(
|
|||
path: "TIMoyaNetworking/Sources",
|
||||
plugins: [.plugin(name: "TISwiftLintPlugin")]),
|
||||
|
||||
.target(name: "TINetworkingCache", dependencies: ["TIFoundationUtils", "TINetworking", "Cache"], path: "TINetworkingCache/Sources"),
|
||||
.target(name: "TINetworkingCache",
|
||||
dependencies: ["TIFoundationUtils", "TINetworking", "Cache"],
|
||||
path: "TINetworkingCache/Sources",
|
||||
plugins: [.plugin(name: "TISwiftLintPlugin")]),
|
||||
|
||||
// MARK: - Maps
|
||||
.target(name: "TIMapUtils", dependencies: [], path: "TIMapUtils/Sources"),
|
||||
.target(name: "TIAppleMapUtils", dependencies: ["TIMapUtils"], path: "TIAppleMapUtils/Sources"),
|
||||
|
||||
.target(name: "TIMapUtils",
|
||||
dependencies: ["TILogging"],
|
||||
path: "TIMapUtils/Sources",
|
||||
plugins: [.plugin(name: "TISwiftLintPlugin")]),
|
||||
|
||||
.target(name: "TIAppleMapUtils",
|
||||
dependencies: ["TIMapUtils"],
|
||||
path: "TIAppleMapUtils/Sources",
|
||||
plugins: [.plugin(name: "TISwiftLintPlugin")]),
|
||||
|
||||
// MARK: - Elements
|
||||
.target(name: "OTPSwiftView", dependencies: ["TIUIElements"], path: "OTPSwiftView/Sources"),
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ target 'TIModuleName' do
|
|||
use_frameworks!
|
||||
|
||||
pod 'TIDependencyModuleName', :path => '../../../../TIDependencyModuleName/TIDependencyModuleName.podspec'
|
||||
pod 'TIModuleName', :path => '../../../../TIModuleName/TIModuleName.podspec'
|
||||
end" > PlaygroundPodfile
|
||||
|
||||
$ nef playground --name TIModuleName --cocoapods --custom-podfile PlaygroundPodfile
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ import TIMapUtils
|
|||
import MapKit
|
||||
|
||||
open class AppleMapManager<DataModel>: BaseMapManager<MKMapView,
|
||||
ApplePlacemarkManager<DataModel>,
|
||||
AppleClusterPlacemarkManager<DataModel>,
|
||||
MKCameraUpdate> {
|
||||
ApplePlacemarkManager<DataModel>,
|
||||
AppleClusterPlacemarkManager<DataModel>,
|
||||
MKCameraUpdate,
|
||||
AppleMapUISettings> {
|
||||
|
||||
public typealias ClusteringIdentifier = String
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 TIMapUtils
|
||||
import MapKit
|
||||
|
||||
open class AppleMapUISettings: BaseMapUISettings<MKMapView> {
|
||||
open class Defaults: BaseMapUISettings<MKMapView>.Defaults {
|
||||
public static var showCompassButton: Bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
public var showCompassButton = false
|
||||
|
||||
public init(showUserLocation: Bool = Defaults.showUserLocation,
|
||||
isZoomEnabled: Bool = Defaults.isZoomEnabled,
|
||||
isTiltEnabled: Bool = Defaults.isTiltEnabled,
|
||||
isRotationEnabled: Bool = Defaults.isRotationEnabled,
|
||||
showCompassButton: Bool = Defaults.showCompassButton) {
|
||||
|
||||
self.showCompassButton = showCompassButton
|
||||
|
||||
super.init(showUserLocation: showUserLocation,
|
||||
isZoomEnabled: isZoomEnabled,
|
||||
isTiltEnabled: isTiltEnabled,
|
||||
isRotationEnabled: isRotationEnabled)
|
||||
}
|
||||
|
||||
override open func apply(to mapView: MKMapView) {
|
||||
super.apply(to: mapView)
|
||||
|
||||
mapView.showsUserLocation = showUserLocation
|
||||
mapView.isZoomEnabled = isZoomEnabled
|
||||
mapView.isPitchEnabled = isTiltEnabled
|
||||
mapView.isRotateEnabled = isRotationEnabled
|
||||
mapView.showsCompass = showCompassButton
|
||||
}
|
||||
}
|
||||
|
|
@ -50,8 +50,13 @@ open class ApplePlacemarkManager<Model>: BaseItemPlacemarkManager<MKAnnotationVi
|
|||
Although the icon is being updated, it is necessary to manually deselect
|
||||
the annotation of the current placemark if it is currently selected.
|
||||
*/
|
||||
if state == .default, let annotation = placemark.annotation {
|
||||
map.deselectAnnotation(annotation, animated: true)
|
||||
if let annotation = placemark.annotation {
|
||||
switch state {
|
||||
case .default:
|
||||
map.deselectAnnotation(annotation, animated: true)
|
||||
case .selected:
|
||||
map.selectAnnotation(annotation, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
placemark.image = iconFactory?.markerIcon(for: dataModel, state: state)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAppleMapUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIMapUtils', s.version.to_s
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAuth'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Login, registration, confirmation and other related actions'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '13.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIFoundationUtils', s.version.to_s
|
||||
s.dependency 'TIKeychainUtils', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ target 'TIDeeplink' do
|
|||
|
||||
pod 'TIFoundationUtils', :path => '../../../../TIFoundationUtils/TIFoundationUtils.podspec'
|
||||
pod 'TISwiftUtils', :path => '../../../../TISwiftUtils/TISwiftUtils.podspec'
|
||||
pod 'TIDeeplink', :path => '../../../../TIDeeplink/TIDeeplink.podspec'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ target 'TIDeeplink' do
|
|||
|
||||
pod 'TIFoundationUtils', :path => '../../../../TIFoundationUtils/TIFoundationUtils.podspec'
|
||||
pod 'TISwiftUtils', :path => '../../../../TISwiftUtils/TISwiftUtils.podspec'
|
||||
pod 'TIDeeplink', :path => '../../../../TIDeeplink/TIDeeplink.podspec'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIDeeplink'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Deeplink service API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIDeveloperUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Universal web view API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -11,7 +11,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIUIKitCore', s.version.to_s
|
||||
s.dependency 'TIUIElements', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIEcommerce'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Cart, products, promocodes, bonuses and other related actions'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
//
|
||||
// Copyright (c) 2023 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.
|
||||
//
|
||||
|
||||
public protocol AsyncSingleValueStorage {
|
||||
associatedtype ValueType
|
||||
associatedtype ErrorType: Error
|
||||
|
||||
func hasStoredValue(completion: @escaping (Bool) -> Void) -> Cancellable
|
||||
func store(value: ValueType, completion: @escaping (Result<Void, ErrorType>) -> Void) -> Cancellable
|
||||
func getValue(completion: @escaping (Result<ValueType, ErrorType>) -> Void) -> Cancellable
|
||||
func deleteValue(completion: @escaping (Result<Void, ErrorType>) -> Void) -> Cancellable
|
||||
}
|
||||
|
||||
@available(iOS 13.0.0, *)
|
||||
public extension AsyncSingleValueStorage {
|
||||
func hasStoredValue() async -> Bool {
|
||||
await withTaskCancellableClosure {
|
||||
hasStoredValue(completion: $0)
|
||||
}
|
||||
}
|
||||
|
||||
func store(value: ValueType) async -> Result<Void, ErrorType> {
|
||||
await withTaskCancellableClosure {
|
||||
store(value: value, completion: $0)
|
||||
}
|
||||
}
|
||||
|
||||
func getValue() async -> Result<ValueType, ErrorType> {
|
||||
await withTaskCancellableClosure {
|
||||
getValue(completion: $0)
|
||||
}
|
||||
}
|
||||
|
||||
func deleteValue() async -> Result<Void, ErrorType> {
|
||||
await withTaskCancellableClosure {
|
||||
deleteValue(completion: $0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 Dispatch
|
||||
|
||||
public struct SingleValueStorageAsyncWrapper<Storage: SingleValueStorage>: AsyncSingleValueStorage {
|
||||
private let wrappedStorage: Storage
|
||||
private let accessQueue: DispatchQueue
|
||||
|
||||
public init(wrappedStorage: Storage, accessQueue: DispatchQueue) {
|
||||
self.wrappedStorage = wrappedStorage
|
||||
self.accessQueue = accessQueue
|
||||
}
|
||||
|
||||
public func hasStoredValue(completion: @escaping (Bool) -> Void) -> Cancellable {
|
||||
withWorkItem(execute: wrappedStorage.hasStoredValue, completion: completion)
|
||||
}
|
||||
|
||||
public func store(value: Storage.ValueType, completion: @escaping (Result<Void, Storage.ErrorType>) -> Void) -> Cancellable {
|
||||
withWorkItem(execute: { wrappedStorage.store(value: value) }, completion: completion)
|
||||
}
|
||||
|
||||
public func getValue(completion: @escaping (Result<Storage.ValueType, Storage.ErrorType>) -> Void) -> Cancellable {
|
||||
withWorkItem(execute: wrappedStorage.getValue, completion: completion)
|
||||
}
|
||||
|
||||
public func deleteValue(completion: @escaping (Result<Void, Storage.ErrorType>) -> Void) -> Cancellable {
|
||||
withWorkItem(execute: wrappedStorage.deleteValue, completion: completion)
|
||||
}
|
||||
|
||||
private func withWorkItem<T>(execute closure: @escaping () -> T, completion: @escaping (T) -> Void) -> Cancellable {
|
||||
let workItem = DispatchWorkItem {
|
||||
completion(closure())
|
||||
}
|
||||
|
||||
accessQueue.async(execute: workItem)
|
||||
|
||||
return workItem
|
||||
}
|
||||
}
|
||||
|
||||
public extension SingleValueStorage {
|
||||
func async(on queue: DispatchQueue) -> SingleValueStorageAsyncWrapper<Self> {
|
||||
SingleValueStorageAsyncWrapper(wrappedStorage: self, accessQueue: queue)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
ENV["DEVELOPMENT_INSTALL"] = "true"
|
||||
|
||||
target 'TIFoundationUtils' do
|
||||
platform :ios, 10.0
|
||||
platform :ios, 11.0
|
||||
use_frameworks!
|
||||
|
||||
pod 'TISwiftUtils', :path => '../../../../TISwiftUtils/TISwiftUtils.podspec'
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
ENV["DEVELOPMENT_INSTALL"] = "true"
|
||||
|
||||
target 'TIFoundationUtils' do
|
||||
platform :ios, 10.0
|
||||
platform :ios, 11.0
|
||||
use_frameworks!
|
||||
|
||||
pod 'TISwiftUtils', :path => '../../../../TISwiftUtils/TISwiftUtils.podspec'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIFoundationUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for Foundation framework classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ import TIMapUtils
|
|||
import GoogleMaps
|
||||
|
||||
open class GoogleMapManager<DataModel>: BaseMapManager<GMSMapView,
|
||||
GooglePlacemarkManager<DataModel>,
|
||||
GoogleClusterPlacemarkManager<DataModel>,
|
||||
GMSCameraUpdate> {
|
||||
GooglePlacemarkManager<DataModel>,
|
||||
GoogleClusterPlacemarkManager<DataModel>,
|
||||
GMSCameraUpdate,
|
||||
GoogleMapUISettings> {
|
||||
|
||||
public init<IF: MarkerIconFactory, CIF: MarkerIconFactory>(map: GMSMapView,
|
||||
positionGetter: @escaping PositionGetter,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 TIMapUtils
|
||||
import GoogleMaps
|
||||
|
||||
open class GoogleMapUISettings: BaseMapUISettings<GMSMapView> {
|
||||
public var showMyLocationButton = true
|
||||
|
||||
open override func apply(to mapView: GMSMapView) {
|
||||
super.apply(to: mapView)
|
||||
|
||||
mapView.isMyLocationEnabled = showUserLocation
|
||||
|
||||
mapView.settings.zoomGestures = isZoomEnabled
|
||||
mapView.settings.tiltGestures = isTiltEnabled
|
||||
mapView.settings.rotateGestures = isRotationEnabled
|
||||
mapView.settings.myLocationButton = showMyLocationButton
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIGoogleMapUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '12.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.static_framework = true
|
||||
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ open class BaseSingleValueKeychainStorage<ValueType>: BaseSingleValueStorage<Val
|
|||
|
||||
let hasValueClosure: HasValueClosure = { keychain, storageKey in
|
||||
Result { try keychain.contains(storageKey.rawValue) }
|
||||
.mapError { StorageError.unableToExtractData(underlyingError: $0) }
|
||||
.mapError { .unableToExtractData(underlyingError: $0) }
|
||||
}
|
||||
|
||||
let deleteValueClosure: DeleteValueClosure = { keychain, storageKey in
|
||||
Result { try keychain.remove(storageKey.rawValue) }
|
||||
.mapError { StorageError.unableToWriteData(underlyingError: $0) }
|
||||
.mapError { .unableToWriteData(underlyingError: $0) }
|
||||
}
|
||||
|
||||
super.init(storage: keychain,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIKeychainUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for Keychain classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIFoundationUtils', s.version.to_s
|
||||
s.dependency 'KeychainAccess', "~> 4.2"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TILogging'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Logging for TI libraries.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,6 +10,13 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,19 +23,19 @@
|
|||
import UIKit
|
||||
|
||||
public struct BorderDrawingOperation: DrawingOperation {
|
||||
public var frameableContentSize: CGSize
|
||||
public var frameableContentRect: CGRect
|
||||
public var border: CGFloat
|
||||
public var color: CGColor
|
||||
public var radius: CGFloat
|
||||
public var exteriorBorder: Bool
|
||||
|
||||
public init(frameableContentSize: CGSize,
|
||||
public init(frameableContentRect: CGRect,
|
||||
border: CGFloat,
|
||||
color: CGColor,
|
||||
radius: CGFloat,
|
||||
exteriorBorder: Bool) {
|
||||
|
||||
self.frameableContentSize = frameableContentSize
|
||||
self.frameableContentRect = frameableContentRect
|
||||
self.border = border
|
||||
self.color = color
|
||||
self.radius = radius
|
||||
|
|
@ -47,10 +47,10 @@ public struct BorderDrawingOperation: DrawingOperation {
|
|||
public func affectedArea(in context: CGContext?) -> CGRect {
|
||||
let margin = exteriorBorder ? border : 0
|
||||
|
||||
let width = frameableContentSize.width + margin * 2
|
||||
let height = frameableContentSize.height + margin * 2
|
||||
let width = frameableContentRect.width + margin * 2
|
||||
let height = frameableContentRect.height + margin * 2
|
||||
|
||||
return CGRect(origin: .zero,
|
||||
return CGRect(origin: frameableContentRect.origin,
|
||||
size: CGSize(width: width, height: height))
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,8 @@ public struct BorderDrawingOperation: DrawingOperation {
|
|||
|
||||
let ctxSize = drawArea.size.ceiledContextSize
|
||||
|
||||
let ctxRect = CGRect(origin: .zero, size: CGSize(width: ctxSize.width, height: ctxSize.height))
|
||||
let ctxRect = CGRect(origin: frameableContentRect.origin,
|
||||
size: CGSize(width: ctxSize.width, height: ctxSize.height))
|
||||
|
||||
let widthDiff = CGFloat(ctxSize.width) - drawArea.width // difference between context width and real width
|
||||
let heightDiff = CGFloat(ctxSize.height) - drawArea.height // difference between context height and real height
|
||||
|
|
|
|||
|
|
@ -0,0 +1,163 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 CoreGraphics
|
||||
|
||||
public struct CurrentLocationDrawingOperation: DrawingOperation {
|
||||
public enum Defaults {
|
||||
public static var iconSize: CGSize {
|
||||
CGSize(width: 27, height: 27)
|
||||
}
|
||||
|
||||
public static var borderWidth: CGFloat {
|
||||
2
|
||||
}
|
||||
}
|
||||
|
||||
public var iconSize: CGSize
|
||||
public var borderWidth: CGFloat
|
||||
public var mainColor: CGColor
|
||||
public var borderColor: CGColor
|
||||
public var backgroundColor: CGColor
|
||||
public var showHeadingArrow: Bool
|
||||
|
||||
private var innerCircleSize: CGSize {
|
||||
CGSize(width: innerBorderSize.width - borderWidth,
|
||||
height: innerBorderSize.height - borderWidth)
|
||||
}
|
||||
|
||||
private var innerBorderSize: CGSize {
|
||||
CGSize(width: outerBorderSize.width - borderWidth,
|
||||
height: outerBorderSize.height - borderWidth)
|
||||
}
|
||||
|
||||
private var outerBorderSize: CGSize {
|
||||
CGSize(width: iconSize.width - 8,
|
||||
height: iconSize.height - 8)
|
||||
}
|
||||
|
||||
private var innerCircleOrigin: CGPoint {
|
||||
CGPoint(x: (iconSize.width - innerCircleSize.width) / 2,
|
||||
y: (iconSize.height - innerCircleSize.height) / 2)
|
||||
}
|
||||
|
||||
private var innerBorderOrigin: CGPoint {
|
||||
CGPoint(x: (iconSize.width - innerBorderSize.width) / 2,
|
||||
y: (iconSize.height - innerBorderSize.height) / 2)
|
||||
}
|
||||
|
||||
private var outerBorderOrigin: CGPoint {
|
||||
CGPoint(x: (iconSize.width - outerBorderSize.width) / 2,
|
||||
y: (iconSize.height - outerBorderSize.height) / 2)
|
||||
}
|
||||
|
||||
private var iconRect: CGRect {
|
||||
CGRect(origin: .zero,
|
||||
size: iconSize)
|
||||
}
|
||||
|
||||
private var innerCircleRect: CGRect {
|
||||
CGRect(origin: innerCircleOrigin,
|
||||
size: innerCircleSize)
|
||||
}
|
||||
|
||||
private var innerBorderRect: CGRect {
|
||||
CGRect(origin: innerBorderOrigin,
|
||||
size: innerBorderSize)
|
||||
}
|
||||
|
||||
private var outerBorderRect: CGRect {
|
||||
CGRect(origin: outerBorderOrigin,
|
||||
size: outerBorderSize)
|
||||
}
|
||||
|
||||
public init(iconSize: CGSize = Defaults.iconSize,
|
||||
borderWidth: CGFloat = Defaults.borderWidth,
|
||||
mainColor: CGColor,
|
||||
borderColor: CGColor,
|
||||
showHeadingArrow: Bool = true) {
|
||||
|
||||
self.iconSize = iconSize
|
||||
self.borderWidth = borderWidth
|
||||
self.mainColor = mainColor
|
||||
self.borderColor = borderColor
|
||||
self.backgroundColor = mainColor.copy(alpha: 0.3) ?? mainColor
|
||||
self.showHeadingArrow = showHeadingArrow
|
||||
}
|
||||
|
||||
public func affectedArea(in context: CGContext? = nil) -> CGRect {
|
||||
iconRect
|
||||
}
|
||||
|
||||
public func apply(in context: CGContext) {
|
||||
let backgroundDrawing = SolidFillDrawingOperation(color: backgroundColor,
|
||||
ellipseRect: iconRect)
|
||||
|
||||
let innerCircleDrawing = SolidFillDrawingOperation(color: mainColor,
|
||||
ellipseRect: innerCircleRect)
|
||||
|
||||
let innerBorderDrawing = BorderDrawingOperation(frameableContentRect: innerBorderRect,
|
||||
border: borderWidth,
|
||||
color: borderColor,
|
||||
radius: min(innerBorderSize.width, innerBorderSize.height) / 2,
|
||||
exteriorBorder: false)
|
||||
|
||||
let outerBorderDrawing = BorderDrawingOperation(frameableContentRect: outerBorderRect,
|
||||
border: borderWidth,
|
||||
color: backgroundColor,
|
||||
radius: min(outerBorderSize.width, outerBorderSize.height) / 2,
|
||||
exteriorBorder: false)
|
||||
|
||||
// flip horizontally
|
||||
|
||||
context.translateBy(x: 0, y: iconSize.height)
|
||||
context.scaleBy(x: 1, y: -1)
|
||||
|
||||
backgroundDrawing.apply(in: context)
|
||||
|
||||
context.setFillColor(mainColor)
|
||||
context.setLineWidth(.zero)
|
||||
|
||||
guard showHeadingArrow else {
|
||||
innerCircleDrawing.apply(in: context)
|
||||
|
||||
innerBorderDrawing.apply(in: context)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
context.addLines(between: [
|
||||
CGPoint(x: innerBorderRect.minX, y: innerBorderRect.midY),
|
||||
CGPoint(x: iconRect.midX, y: iconRect.maxY),
|
||||
CGPoint(x: innerBorderRect.maxX, y: innerBorderRect.midY)
|
||||
])
|
||||
|
||||
context.drawPath(using: .fillStroke)
|
||||
|
||||
innerCircleDrawing.apply(in: context)
|
||||
|
||||
innerBorderDrawing.apply(in: context)
|
||||
|
||||
context.setBlendMode(.destinationAtop)
|
||||
outerBorderDrawing.apply(in: context)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 CoreLocation
|
||||
import TILogging
|
||||
|
||||
open class UserLocationFetcher: NSObject, CLLocationManagerDelegate {
|
||||
public enum AccuracyRequest {
|
||||
case `default`
|
||||
case fullAccuracy(purposeKey: String)
|
||||
}
|
||||
|
||||
public enum Failure: Error {
|
||||
case restricted
|
||||
case denied
|
||||
case fullAccuracyDenied
|
||||
}
|
||||
|
||||
public typealias LocationCallback = (CLLocation) -> Void
|
||||
public typealias OnAuthSuccessCallback = (CLLocationManager) -> Void
|
||||
public typealias OnAuthFailureCallback = (Failure) -> Void
|
||||
|
||||
public var locationManager: CLLocationManager
|
||||
public var accuracyRequest: AccuracyRequest
|
||||
|
||||
public var authorized: Bool {
|
||||
if #available(iOS 14.0, *) {
|
||||
return isAuthorized(status: locationManager.authorizationStatus)
|
||||
} else {
|
||||
return isAuthorized(status: CLLocationManager.authorizationStatus())
|
||||
}
|
||||
}
|
||||
|
||||
var authorizedFullAccuracy: Bool {
|
||||
if #available(iOS 14.0, *) {
|
||||
switch locationManager.accuracyAuthorization {
|
||||
case .fullAccuracy:
|
||||
return true
|
||||
|
||||
case .reducedAccuracy:
|
||||
return false
|
||||
|
||||
@unknown default:
|
||||
assertionFailure("Unimplemented accuracyAuthorization case: \(locationManager.accuracyAuthorization)")
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public var authorizedAccuracy: Bool {
|
||||
switch accuracyRequest {
|
||||
case .default:
|
||||
return true
|
||||
|
||||
case .fullAccuracy:
|
||||
return authorizedFullAccuracy
|
||||
}
|
||||
}
|
||||
|
||||
public var authSuccessCallback: OnAuthSuccessCallback
|
||||
public var authFailureCallback: OnAuthFailureCallback?
|
||||
|
||||
public var locationCallback: LocationCallback?
|
||||
|
||||
public var logger: ErrorLogger = DefaultOSLogErrorLogger(subsystem: "TIMapUtils", category: "UserLocationFetcher")
|
||||
|
||||
public init(locationManager: CLLocationManager = CLLocationManager(),
|
||||
accuracyRequest: AccuracyRequest = .default,
|
||||
onSuccess: @escaping OnAuthSuccessCallback = { $0.requestLocation() },
|
||||
onFailure: OnAuthFailureCallback? = nil,
|
||||
locationCallback: LocationCallback? = nil) {
|
||||
|
||||
self.locationManager = locationManager
|
||||
self.accuracyRequest = accuracyRequest
|
||||
self.authSuccessCallback = onSuccess
|
||||
self.authFailureCallback = onFailure
|
||||
self.locationCallback = locationCallback
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
open func requestLocationUpdates(onlyIfHasAccess: Bool = false) {
|
||||
if authorized && authorizedAccuracy || !onlyIfHasAccess {
|
||||
locationManager.delegate = self
|
||||
}
|
||||
}
|
||||
|
||||
open func requestAuth(for manager: CLLocationManager) {
|
||||
manager.requestWhenInUseAuthorization()
|
||||
}
|
||||
|
||||
open func isAuthorized(status: CLAuthorizationStatus) -> Bool {
|
||||
switch status {
|
||||
case .authorizedWhenInUse, .authorizedAlways:
|
||||
return true
|
||||
|
||||
case .restricted, .denied:
|
||||
return false
|
||||
|
||||
case .notDetermined:
|
||||
return false
|
||||
|
||||
@unknown default:
|
||||
assertionFailure("Unimplemented authorizationStatus case: \(status))")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CLLocationManagerDelegate
|
||||
|
||||
open func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
|
||||
switch status {
|
||||
case .notDetermined:
|
||||
requestAuth(for: manager)
|
||||
|
||||
case .restricted:
|
||||
authFailureCallback?(.restricted)
|
||||
|
||||
case .denied:
|
||||
authFailureCallback?(.denied)
|
||||
|
||||
case .authorizedAlways, .authorizedWhenInUse:
|
||||
handleSuccessAuthorization(with: status, for: manager)
|
||||
|
||||
@unknown default:
|
||||
assertionFailure("Unimplemented authorizationStatus case: \(status))")
|
||||
authSuccessCallback(manager)
|
||||
}
|
||||
}
|
||||
|
||||
open func handleSuccessAuthorization(with status: CLAuthorizationStatus, for manager: CLLocationManager) {
|
||||
if authorizedFullAccuracy {
|
||||
authSuccessCallback(manager)
|
||||
} else {
|
||||
switch accuracyRequest {
|
||||
case let .fullAccuracy(purposeKey):
|
||||
if #available(iOS 14.0, *) {
|
||||
locationManager.requestTemporaryFullAccuracyAuthorization(withPurposeKey: purposeKey) { [weak self] in
|
||||
if $0 != nil {
|
||||
self?.authFailureCallback?(.fullAccuracyDenied)
|
||||
} else {
|
||||
self?.authSuccessCallback(manager)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
authSuccessCallback(manager)
|
||||
}
|
||||
|
||||
case .default:
|
||||
authSuccessCallback(manager)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
guard let locationCallback else {
|
||||
return
|
||||
}
|
||||
|
||||
locations.forEach(locationCallback)
|
||||
}
|
||||
|
||||
open func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
|
||||
logger.log(error: error, file: #file, line: #line)
|
||||
}
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ open class DefaultClusterIconRenderer {
|
|||
open func borderDrawingOperation(iconSize: CGSize,
|
||||
cornerRadius: CGFloat) -> DrawingOperation {
|
||||
|
||||
BorderDrawingOperation(frameableContentSize: iconSize,
|
||||
BorderDrawingOperation(frameableContentRect: CGRect(origin: .zero, size: iconSize),
|
||||
border: borderWidth,
|
||||
color: border.color.cgColor,
|
||||
radius: cornerRadius,
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ import UIKit.UIGeometry
|
|||
open class BaseMapManager<Map: AnyObject,
|
||||
PM: PlacemarkManager,
|
||||
CPM: PlacemarkManager,
|
||||
CUF: CameraUpdateFactory> where PM.Position: LocationCoordinate,
|
||||
PM.Position == CUF.Position,
|
||||
CUF.Update.Map == Map,
|
||||
CUF.BoundingBox == CPM.Position {
|
||||
CUF: CameraUpdateFactory,
|
||||
MS: MapUISettings> where PM.Position: LocationCoordinate,
|
||||
PM.Position == CUF.Position,
|
||||
CUF.Update.Map == Map,
|
||||
CUF.BoundingBox == CPM.Position,
|
||||
MS.MapView == Map {
|
||||
|
||||
public typealias PositionGetter = (PM.DataModel) -> PM.Position?
|
||||
|
||||
|
|
@ -41,6 +43,8 @@ open class BaseMapManager<Map: AnyObject,
|
|||
public typealias CameraUpdateOnPointTap = (CUF.Position) -> CUF.Update
|
||||
public typealias CameraUpdateOnClusterTap = (CUF.BoundingBox) -> CUF.Update
|
||||
|
||||
public typealias LocationCallback = (PM.Position) -> Void
|
||||
|
||||
private let placemarkManagerCreator: PlacemarkManagerCreator
|
||||
private let clusterPlacemarkManagerCreator: ClusterPlacemarkManagerCreator
|
||||
|
||||
|
|
@ -55,6 +59,8 @@ open class BaseMapManager<Map: AnyObject,
|
|||
|
||||
public var cameraUpdateOnMarkersAdded: CUF.Update?
|
||||
|
||||
public var settings: MS?
|
||||
|
||||
public var cameraUpdateOnMarkerTap: CameraUpdateOnPointTap? = {
|
||||
CUF.update(for: .focus(target: $0, zoom: CommonZoomLevels.building.floatValue))
|
||||
}
|
||||
|
|
@ -79,8 +85,12 @@ open class BaseMapManager<Map: AnyObject,
|
|||
}
|
||||
|
||||
open func set(items: [PM.DataModel]) {
|
||||
let placemarkTapHandler: PM.TapHandlerClosure = { [weak map, selectPlacemarkHandler, animationDuration, cameraUpdateOnMarkerTap] model, location in
|
||||
if let map = map {
|
||||
// closure capture alternative
|
||||
let animationDuration = animationDuration
|
||||
weak var weakMap = map
|
||||
|
||||
let placemarkTapHandler: PM.TapHandlerClosure = { [selectPlacemarkHandler, cameraUpdateOnMarkerTap] model, location in
|
||||
if let map = weakMap {
|
||||
cameraUpdateOnMarkerTap?(location).update(map: map, animationDuration: animationDuration)
|
||||
}
|
||||
|
||||
|
|
@ -89,8 +99,8 @@ open class BaseMapManager<Map: AnyObject,
|
|||
|
||||
let placemarkManagers = items.compactMap { placemarkManagerCreator($0, placemarkTapHandler) }
|
||||
|
||||
let clusterTapHandler: CPM.TapHandlerClosure = { [weak map, animationDuration, cameraUpdateOnClusterTap] managers, boundingBox in
|
||||
if let map = map {
|
||||
let clusterTapHandler: CPM.TapHandlerClosure = { [cameraUpdateOnClusterTap] _, boundingBox in
|
||||
if let map = weakMap {
|
||||
cameraUpdateOnClusterTap?(boundingBox).update(map: map, animationDuration: animationDuration)
|
||||
}
|
||||
|
||||
|
|
@ -103,10 +113,16 @@ open class BaseMapManager<Map: AnyObject,
|
|||
|
||||
self.clusterPlacemarkManager = clusterPlacemarkManagerCreator(placemarkManagers, clusterTapHandler)
|
||||
|
||||
cameraUpdateOnMarkersAdded?.update(map: map, animationDuration: animationDuration)
|
||||
cameraUpdateOnMarkersAdded?.update(map: self.map, animationDuration: animationDuration)
|
||||
}
|
||||
|
||||
open func remove(clusterPlacemarkManager: CPM) {
|
||||
// override in subclass
|
||||
}
|
||||
|
||||
open func apply(settings: MS) {
|
||||
self.settings = settings
|
||||
|
||||
settings.apply(to: map)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
//
|
||||
// Copyright (c) 2023 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.
|
||||
//
|
||||
|
||||
open class BaseMapUISettings<MapView>: MapUISettings {
|
||||
open class Defaults { // swiftlint:disable:this convenience_type
|
||||
public static var showUserLocation: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
public static var isZoomEnabled: Bool {
|
||||
true
|
||||
}
|
||||
|
||||
public static var isTiltEnabled: Bool {
|
||||
false
|
||||
}
|
||||
|
||||
public static var isRotationEnabled: Bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
public var showUserLocation: Bool
|
||||
|
||||
public var isZoomEnabled: Bool
|
||||
public var isTiltEnabled: Bool
|
||||
public var isRotationEnabled: Bool
|
||||
|
||||
public init(showUserLocation: Bool = Defaults.showUserLocation,
|
||||
isZoomEnabled: Bool = Defaults.isZoomEnabled,
|
||||
isTiltEnabled: Bool = Defaults.isTiltEnabled,
|
||||
isRotationEnabled: Bool = Defaults.isRotationEnabled) {
|
||||
|
||||
self.showUserLocation = showUserLocation
|
||||
self.isZoomEnabled = isZoomEnabled
|
||||
self.isTiltEnabled = isTiltEnabled
|
||||
self.isRotationEnabled = isRotationEnabled
|
||||
}
|
||||
|
||||
open func apply(to mapView: MapView) {
|
||||
// override in subclass
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// Copyright (c) 2023 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.
|
||||
//
|
||||
|
||||
public protocol MapUISettings: AnyObject {
|
||||
associatedtype MapView
|
||||
|
||||
var isZoomEnabled: Bool { get set }
|
||||
var isTiltEnabled: Bool { get set }
|
||||
var isRotationEnabled: Bool { get set }
|
||||
|
||||
var showUserLocation: Bool { get set }
|
||||
|
||||
func apply(to mapView: MapView)
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMapUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,6 +10,15 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TILogging', s.version.to_s
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMoyaNetworking'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Moya + Swagger network service.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/**/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TINetworking', s.version.to_s
|
||||
s.dependency 'TIFoundationUtils', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworking'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Swagger-frendly networking layer helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIFoundationUtils', s.version.to_s
|
||||
s.dependency 'TILogging', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -25,31 +25,15 @@ import TIFoundationUtils
|
|||
import Cache
|
||||
import Foundation
|
||||
|
||||
public struct EndpointCacheService<Content: Codable> {
|
||||
public struct EndpointCacheService<Content: Codable>: SingleValueStorage {
|
||||
private let serializedRequest: SerializedRequest
|
||||
private let multiLevelStorage: Storage<SerializedRequest, Content>
|
||||
|
||||
public var cachedContent: Content? {
|
||||
get {
|
||||
guard let entry = try? multiLevelStorage.entry(forKey: serializedRequest), !entry.expiry.isExpired else {
|
||||
try? multiLevelStorage.removeObject(forKey: serializedRequest)
|
||||
return nil
|
||||
}
|
||||
|
||||
return entry.object
|
||||
}
|
||||
nonmutating set {
|
||||
if let object = newValue {
|
||||
try? multiLevelStorage.setObject(object,
|
||||
forKey: serializedRequest)
|
||||
} else {
|
||||
try? multiLevelStorage.removeObject(forKey: serializedRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
public typealias ContentRequestClosure<Failure: Error> = (@escaping (Swift.Result<Content, Failure>) -> Void) -> Cancellable
|
||||
public typealias FetchContentCompletion<Failure: Error> = (Swift.Result<Content, Failure>) -> Void
|
||||
|
||||
public init(serializedRequest: SerializedRequest,
|
||||
cacheLifetime: TimeInterval,
|
||||
cacheLifetime: Expiry,
|
||||
jsonCodingConfigurator: JsonCodingConfigurator) throws {
|
||||
|
||||
self.serializedRequest = serializedRequest
|
||||
|
|
@ -63,8 +47,8 @@ public struct EndpointCacheService<Content: Codable> {
|
|||
}
|
||||
|
||||
let diskConfig = DiskConfig(name: nameWithoutLeadingSlash,
|
||||
expiry: .seconds(cacheLifetime))
|
||||
let memoryConfig = MemoryConfig(expiry: .seconds(cacheLifetime),
|
||||
expiry: cacheLifetime)
|
||||
let memoryConfig = MemoryConfig(expiry: cacheLifetime,
|
||||
countLimit: 0,
|
||||
totalCostLimit: 0)
|
||||
|
||||
|
|
@ -78,4 +62,111 @@ public struct EndpointCacheService<Content: Codable> {
|
|||
memoryConfig: memoryConfig,
|
||||
transformer: transformer)
|
||||
}
|
||||
|
||||
// MARK: - SingleValueStorage
|
||||
|
||||
public func hasStoredValue() -> Bool {
|
||||
do {
|
||||
return try multiLevelStorage.existsObject(forKey: serializedRequest) &&
|
||||
!(try multiLevelStorage.isExpiredObject(forKey: serializedRequest))
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
public func store(value: Content) -> Swift.Result<Void, Cache.StorageError> {
|
||||
do {
|
||||
return .success(try multiLevelStorage.setObject(value, forKey: serializedRequest))
|
||||
} catch let storageError as Cache.StorageError {
|
||||
return .failure(storageError)
|
||||
} catch {
|
||||
return .failure(.decodingFailed)
|
||||
}
|
||||
}
|
||||
|
||||
public func getValue() -> Swift.Result<Content, Cache.StorageError> {
|
||||
guard hasStoredValue() else {
|
||||
return .failure(.notFound)
|
||||
}
|
||||
do {
|
||||
return .success(try multiLevelStorage.object(forKey: serializedRequest))
|
||||
} catch let storageError as Cache.StorageError {
|
||||
return .failure(storageError)
|
||||
} catch {
|
||||
return .failure(.encodingFailed)
|
||||
}
|
||||
}
|
||||
|
||||
public func deleteValue() -> Swift.Result<Void, Cache.StorageError> {
|
||||
do {
|
||||
return .success(try multiLevelStorage.removeObject(forKey: serializedRequest))
|
||||
} catch let storageError as Cache.StorageError {
|
||||
return .failure(storageError)
|
||||
} catch {
|
||||
return .failure(.notFound)
|
||||
}
|
||||
}
|
||||
|
||||
public func async() -> SingleValueStorageAsyncWrapper<Self> {
|
||||
async(on: multiLevelStorage.async.serialQueue)
|
||||
}
|
||||
|
||||
public func getCachedOrRequest<Failure: Error>(from requestClosure: @escaping ContentRequestClosure<Failure>,
|
||||
completion: @escaping FetchContentCompletion<Failure>) -> Cancellable {
|
||||
Cancellables.scoped { cancellableBag in
|
||||
let asyncCache = async()
|
||||
|
||||
return asyncCache.hasStoredValue {
|
||||
if $0 {
|
||||
fetchCached(from: asyncCache,
|
||||
cancellableBag: cancellableBag,
|
||||
requestClosure: requestClosure,
|
||||
completion: completion)
|
||||
} else {
|
||||
requestClosure {
|
||||
if case let .success(newValue) = $0 {
|
||||
_ = store(value: newValue)
|
||||
}
|
||||
|
||||
completion($0)
|
||||
}
|
||||
.add(to: cancellableBag)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func fetchCached<Failure: Error,
|
||||
AsyncStorage: AsyncSingleValueStorage>(from asyncCache: AsyncStorage,
|
||||
cancellableBag: BaseCancellableBag,
|
||||
requestClosure: @escaping ContentRequestClosure<Failure>,
|
||||
completion: @escaping FetchContentCompletion<Failure>)
|
||||
where AsyncStorage.ValueType == Content {
|
||||
|
||||
guard !cancellableBag.isCancelled else {
|
||||
return
|
||||
}
|
||||
|
||||
asyncCache.getValue {
|
||||
switch $0 {
|
||||
case let .success(cachedValue):
|
||||
completion(.success(cachedValue))
|
||||
|
||||
case .failure:
|
||||
guard !cancellableBag.isCancelled else {
|
||||
return
|
||||
}
|
||||
|
||||
requestClosure {
|
||||
if case let .success(newValue) = $0 {
|
||||
_ = store(value: newValue)
|
||||
}
|
||||
|
||||
completion($0)
|
||||
}
|
||||
.add(to: cancellableBag)
|
||||
}
|
||||
}
|
||||
.add(to: cancellableBag)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworkingCache'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Caching results of EndpointRequests.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIFoundationUtils', s.version.to_s
|
||||
s.dependency 'TINetworking', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIPagination'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Generic pagination component.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUICore'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '13.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.dependency 'TIUIKitCore', s.version.to_s
|
||||
s.dependency 'TISwiftUtils', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@
|
|||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
// swiftlint:disable parameter_closure
|
||||
|
||||
// MARK: - Basic closures
|
||||
|
||||
/// Closure with custom arguments and return value.
|
||||
public typealias Closure<Input, Output> = (Input) -> Output
|
||||
|
||||
|
|
@ -29,7 +33,7 @@ public typealias ResultClosure<Output> = () -> Output
|
|||
/// Closure that takes custom arguments and returns Void.
|
||||
public typealias ParameterClosure<Input> = Closure<Input, Void>
|
||||
|
||||
// MARK: Throwable versions
|
||||
// MARK: - Throwable versions
|
||||
|
||||
/// Closure with custom arguments and return value, may throw an error.
|
||||
public typealias ThrowableClosure<Input, Output> = (Input) throws -> Output
|
||||
|
|
@ -40,7 +44,7 @@ public typealias ThrowableResultClosure<Output> = () throws -> Output
|
|||
/// Closure that takes custom arguments and returns Void, may throw an error.
|
||||
public typealias ThrowableParameterClosure<Input> = ThrowableClosure<Input, Void>
|
||||
|
||||
// MARK: Concrete closures
|
||||
// MARK: - Concrete closures
|
||||
|
||||
/// Closure that takes no arguments and returns Void.
|
||||
public typealias VoidClosure = ResultClosure<Void>
|
||||
|
|
@ -48,6 +52,7 @@ public typealias VoidClosure = ResultClosure<Void>
|
|||
/// Closure that takes no arguments, may throw an error and returns Void.
|
||||
public typealias ThrowableVoidClosure = () throws -> Void
|
||||
|
||||
// MARK: - Async versions
|
||||
|
||||
/// Async closure with custom arguments and return value.
|
||||
public typealias AsyncClosure<Input, Output> = (Input) async -> Output
|
||||
|
|
@ -58,7 +63,7 @@ public typealias AsyncResultClosure<Output> = () async -> Output
|
|||
/// Async closure that takes custom arguments and returns Void.
|
||||
public typealias AsyncParameterClosure<Input> = AsyncClosure<Input, Void>
|
||||
|
||||
// MARK: Async throwable versions
|
||||
// MARK: - Async throwable versions
|
||||
|
||||
/// Async closure with custom arguments and return value, may throw an error.
|
||||
public typealias ThrowableAsyncClosure<Input, Output> = (Input) async throws -> Output
|
||||
|
|
@ -69,10 +74,72 @@ public typealias ThrowableAsyncResultClosure<Output> = () async throws -> Output
|
|||
/// Async closure that takes custom arguments and returns Void, may throw an error.
|
||||
public typealias ThrowableAsyncParameterClosure<Input> = ThrowableAsyncClosure<Input, Void>
|
||||
|
||||
// MARK: Async concrete closures
|
||||
// MARK: - Async concrete closures
|
||||
|
||||
/// Async closure that takes no arguments and returns Void.
|
||||
public typealias AsyncVoidClosure = AsyncResultClosure<Void>
|
||||
|
||||
/// Async closure that takes no arguments, may throw an error and returns Void.
|
||||
public typealias ThrowableAsyncVoidClosure = () async throws -> Void
|
||||
|
||||
// MARK: - @MainActor basic closures
|
||||
|
||||
/// @MainActor closure with custom arguments and return value.
|
||||
public typealias UIClosure<Input, Output> = @MainActor (Input) -> Output
|
||||
|
||||
/// @MainActor closure with no arguments and custom return value.
|
||||
public typealias UIResultClosure<Output> = @MainActor () -> Output
|
||||
|
||||
/// @MainActior closure that takes custom arguments and returns Void.
|
||||
public typealias UIParameterClosure<Input> = UIClosure<Input, Void>
|
||||
|
||||
// MARK: - Throwable @MainActor versions
|
||||
|
||||
/// @MainActor closure with custom arguments and return value, may throw an error.
|
||||
public typealias UIThrowableClosure<Input, Output> = @MainActor (Input) throws -> Output
|
||||
|
||||
/// @MainActor closure with no arguments and custom return value, may throw an error.
|
||||
public typealias UIThrowableResultClosure<Output> = @MainActor () throws -> Output
|
||||
|
||||
/// @MainActior closure that takes custom arguments and returns Void, may throw an error.
|
||||
public typealias UIThrowableParameterClosure<Input> = UIThrowableClosure<Input, Void>
|
||||
|
||||
// MARK: - Concrete @MainActor closures
|
||||
|
||||
/// @MainActior closure that takes no arguments and returns Void.
|
||||
public typealias UIVoidClosure = UIResultClosure<Void>
|
||||
|
||||
/// @MainActior closure that takes no arguments, may throw an error and returns Void.
|
||||
public typealias UIThrowableVoidClosure = @MainActor () throws -> Void
|
||||
|
||||
/// Async @MainActor closure with custom arguments and return value.
|
||||
public typealias UIAsyncClosure<Input, Output> = @MainActor (Input) async -> Output
|
||||
|
||||
// MARK: - @MainActor async basic closures
|
||||
|
||||
/// Async @MainActor closure with no arguments and custom return value.
|
||||
public typealias UIAsyncResultClosure<Output> = @MainActor () async -> Output
|
||||
|
||||
/// Async @MainActior closure that takes custom arguments and returns Void.
|
||||
public typealias UIAsyncParameterClosure<Input> = AsyncClosure<Input, Void>
|
||||
|
||||
// MARK: - @MainActor async throwable versions
|
||||
|
||||
/// Async @MainActor closure with custom arguments and return value, may throw an error.
|
||||
public typealias UIThrowableAsyncClosure<Input, Output> = @MainActor (Input) async throws -> Output
|
||||
|
||||
/// Async @MainActor closure with no arguments and custom return value, may throw an error.
|
||||
public typealias UIThrowableAsyncResultClosure<Output> = @MainActor () async throws -> Output
|
||||
|
||||
/// Async @MainActior closure that takes custom arguments and returns Void, may throw an error.
|
||||
public typealias UIThrowableAsyncParameterClosure<Input> = UIThrowableAsyncClosure<Input, Void>
|
||||
|
||||
// MARK: - @MainActor async concrete closures
|
||||
|
||||
/// Async @MainActior closure that takes no arguments and returns Void.
|
||||
public typealias UIAsyncVoidClosure = UIAsyncResultClosure<Void>
|
||||
|
||||
/// Async @MainActior closure that takes no arguments, may throw an error and returns Void.
|
||||
public typealias UIThrowableAsyncVoidClosure = @MainActor () async throws -> Void
|
||||
|
||||
// swiftlint:enable parameter_closure
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Bunch of useful helpers for Swift development.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITableKitUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for TableKit classes.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
ENV["DEVELOPMENT_INSTALL"] = "true"
|
||||
|
||||
target 'TITextProcessing' do
|
||||
platform :ios, 10
|
||||
platform :ios, 11
|
||||
use_frameworks!
|
||||
|
||||
pod 'TITextProcessing', :path => '../../../../TITextProcessing/TITextProcessing.podspec'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
ENV["DEVELOPMENT_INSTALL"] = "true"
|
||||
|
||||
target 'TITextProcessing' do
|
||||
platform :ios, 10
|
||||
platform :ios, 11
|
||||
use_frameworks!
|
||||
|
||||
pod 'TITextProcessing', :path => '../../../../TITextProcessing/TITextProcessing.podspec'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
let cardNumberTextFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getRegexReplacement())
|
||||
print(cardNumberTextFormatter.getRegexReplacement())
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -40,12 +40,7 @@ print(textFormatter.getRegexReplacement())
|
|||
**Output**: `1234 5678 9012 3456`
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getRegexPlaceholder())
|
||||
print(cardNumberTextFormatter.getRegexPlaceholder())
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -63,12 +58,7 @@ print(textFormatter.getRegexPlaceholder())
|
|||
> P.S. Учитываем, что `TextFormatter` был проинициализирован со слеюущим регулярным выражением: `(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})`
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getFormattedText("2200111555550080"))
|
||||
print(cardNumberTextFormatter.getFormattedText("2200111555550080"))
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -85,9 +75,6 @@ print(textFormatter.getFormattedText("2200111555550080"))
|
|||
Функция, преобразующий входящее регулярное выражение в структуру, содержащую шаблон подстановки и матрицу символов, например:
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let replaceGenerator: RegexReplaceGenerator = DefaultRegexReplaceGenerator()
|
||||
let item = replaceGenerator.generateReplacement(for: "(\\d{2})\\/?(\\d{2})")
|
||||
|
||||
|
|
@ -126,9 +113,6 @@ print(item.matrixOfSymbols)
|
|||
Функция, преобразующая входящую матрицу символов в текст-заполнитель, например:
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let matrix: [[Character]] = [
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
|
|
@ -151,9 +135,6 @@ print(placeholder)
|
|||
## - Примеры использования:
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
// MARK: - Форматирование даты
|
||||
|
||||
let dateRegex = "(\\d{2})\\/?(\\d{2})"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITextProcessing'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'A text processing service helping to get a text mask and a placeholder from incoming regex.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,13 +10,13 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
sources = '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + sources
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIElements'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Bunch of useful protocols and views.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -11,12 +11,12 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
sources = '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + sources
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIKitCore'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -11,7 +11,15 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '11.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.framework = 'UIKit'
|
||||
|
||||
s.dependency 'TISwiftUtils', s.version.to_s
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIWebView'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Universal web view API'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ import TIMapUtils
|
|||
import YandexMapsMobile
|
||||
|
||||
open class YandexMapManager<DataModel>: BaseMapManager<YMKMapView,
|
||||
YandexPlacemarkManager<DataModel>,
|
||||
YandexClusterPlacemarkManager<DataModel>,
|
||||
YMKCameraUpdate> {
|
||||
YandexPlacemarkManager<DataModel>,
|
||||
YandexClusterPlacemarkManager<DataModel>,
|
||||
YMKCameraUpdate,
|
||||
YandexMapUISettings> {
|
||||
|
||||
public init<IF: MarkerIconFactory, CIF: MarkerIconFactory>(map: YMKMapView,
|
||||
positionGetter: @escaping PositionGetter,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,135 @@
|
|||
//
|
||||
// Copyright (c) 2023 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 TIMapUtils
|
||||
import YandexMapsMobile
|
||||
|
||||
open class YandexMapUISettings: BaseMapUISettings<YMKMapView> {
|
||||
open class UserLocationObjectListener: NSObject, YMKUserLocationObjectListener {
|
||||
public var tintColor: UIColor {
|
||||
didSet {
|
||||
userLocationView?.accuracyCircle.fillColor = tintColor.withAlphaComponent(0.2)
|
||||
}
|
||||
}
|
||||
|
||||
public var currentLocationIcon: UIImage {
|
||||
didSet {
|
||||
updateCurrentLocationIcon()
|
||||
}
|
||||
}
|
||||
|
||||
private weak var userLocationView: YMKUserLocationView?
|
||||
|
||||
public init(tintColor: UIColor, currentLocationIcon: UIImage) {
|
||||
self.tintColor = tintColor
|
||||
self.currentLocationIcon = currentLocationIcon
|
||||
}
|
||||
|
||||
// MARK: - YMKUserLocationObjectListener
|
||||
|
||||
open func onObjectAdded(with view: YMKUserLocationView) {
|
||||
self.userLocationView = view
|
||||
|
||||
updateCurrentLocationIcon()
|
||||
|
||||
view.accuracyCircle.fillColor = tintColor.withAlphaComponent(0.2)
|
||||
}
|
||||
|
||||
open func onObjectRemoved(with view: YMKUserLocationView) {}
|
||||
|
||||
open func onObjectUpdated(with view: YMKUserLocationView, event: YMKObjectEvent) {}
|
||||
|
||||
private func updateCurrentLocationIcon() {
|
||||
userLocationView?.arrow.setIconWith(currentLocationIcon)
|
||||
|
||||
let style = YMKIconStyle(anchor: CGPoint(x: 0.5, y: 0.5) as NSValue,
|
||||
rotationType:YMKRotationType.rotate.rawValue as NSNumber,
|
||||
zIndex: 0,
|
||||
flat: true,
|
||||
visible: true,
|
||||
scale: 1,
|
||||
tappableArea: nil)
|
||||
|
||||
userLocationView?.pin.setIconWith(currentLocationIcon, style: style)
|
||||
}
|
||||
}
|
||||
|
||||
public weak var userLocationLayer: YMKUserLocationLayer?
|
||||
public weak var mapKit: YMKMapKit?
|
||||
public var userLocationObjectListener: UserLocationObjectListener?
|
||||
|
||||
public var tintColor: UIColor = .red {
|
||||
didSet {
|
||||
userLocationObjectListener?.tintColor = tintColor
|
||||
}
|
||||
}
|
||||
|
||||
public var showHeadingArrow: Bool = true {
|
||||
didSet {
|
||||
userLocationObjectListener?.currentLocationIcon = currentLocationIcon(showHeadingArrow: showHeadingArrow)
|
||||
}
|
||||
}
|
||||
|
||||
public init(mapKit: YMKMapKit = .sharedInstance()) {
|
||||
self.mapKit = mapKit
|
||||
}
|
||||
|
||||
open override func apply(to mapView: YMKMapView) {
|
||||
super.apply(to: mapView)
|
||||
|
||||
if showUserLocation {
|
||||
if userLocationLayer == nil {
|
||||
userLocationLayer = mapKit?.createUserLocationLayer(with: mapView.mapWindow)
|
||||
}
|
||||
|
||||
let currentLocationIcon = currentLocationIcon(showHeadingArrow: showHeadingArrow)
|
||||
|
||||
userLocationObjectListener = UserLocationObjectListener(tintColor: tintColor,
|
||||
currentLocationIcon: currentLocationIcon)
|
||||
} else {
|
||||
userLocationObjectListener = nil
|
||||
}
|
||||
|
||||
userLocationLayer?.setVisibleWithOn(showUserLocation)
|
||||
userLocationLayer?.setObjectListenerWith(userLocationObjectListener)
|
||||
|
||||
let map = mapView.mapWindow.map
|
||||
|
||||
map.isZoomGesturesEnabled = isZoomEnabled
|
||||
map.isTiltGesturesEnabled = isTiltEnabled
|
||||
map.isRotateGesturesEnabled = isRotationEnabled
|
||||
}
|
||||
|
||||
// MARK: - Subclass override
|
||||
|
||||
open func currentLocationIcon(showHeadingArrow: Bool = true) -> UIImage {
|
||||
let locationDrawingOperation = CurrentLocationDrawingOperation(mainColor: tintColor.cgColor,
|
||||
borderColor: UIColor.white.cgColor,
|
||||
showHeadingArrow: showHeadingArrow)
|
||||
|
||||
let renderer = UIGraphicsImageRenderer(bounds: locationDrawingOperation.affectedArea())
|
||||
|
||||
return renderer.image {
|
||||
locationDrawingOperation.apply(in: $0.cgContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIYandexMapUtils'
|
||||
s.version = '1.45.0'
|
||||
s.version = '1.46.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.'
|
||||
s.homepage = 'https://git.svc.touchin.ru/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
@ -10,7 +10,14 @@ Pod::Spec.new do |s|
|
|||
s.ios.deployment_target = '12.0'
|
||||
s.swift_versions = ['5.7']
|
||||
|
||||
s.source_files = s.name + '/Sources/**/*'
|
||||
sources = 'Sources/**/*'
|
||||
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
|
||||
s.source_files = sources
|
||||
s.exclude_files = s.name + '.app'
|
||||
else
|
||||
s.source_files = s.name + '/' + sources
|
||||
s.exclude_files = s.name + '/*.app'
|
||||
end
|
||||
|
||||
s.static_framework = true
|
||||
s.user_target_xcconfig = { 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@
|
|||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
let cardNumberTextFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getRegexReplacement())
|
||||
print(cardNumberTextFormatter.getRegexReplacement())
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -40,12 +40,7 @@ print(textFormatter.getRegexReplacement())
|
|||
**Output**: `1234 5678 9012 3456`
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getRegexPlaceholder())
|
||||
print(cardNumberTextFormatter.getRegexPlaceholder())
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -63,12 +58,7 @@ print(textFormatter.getRegexPlaceholder())
|
|||
> P.S. Учитываем, что `TextFormatter` был проинициализирован со слеюущим регулярным выражением: `(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})`
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let textFormatter = TextFormatter(regex: "(\\d{4}) ?(\\d{4}) ?(\\d{4}) ?(\\d{4})")
|
||||
|
||||
print(textFormatter.getFormattedText("2200111555550080"))
|
||||
print(cardNumberTextFormatter.getFormattedText("2200111555550080"))
|
||||
|
||||
/*
|
||||
Выведет в консоль:
|
||||
|
|
@ -85,9 +75,6 @@ print(textFormatter.getFormattedText("2200111555550080"))
|
|||
Функция, преобразующий входящее регулярное выражение в структуру, содержащую шаблон подстановки и матрицу символов, например:
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let replaceGenerator: RegexReplaceGenerator = DefaultRegexReplaceGenerator()
|
||||
let item = replaceGenerator.generateReplacement(for: "(\\d{2})\\/?(\\d{2})")
|
||||
|
||||
|
|
@ -126,9 +113,6 @@ print(item.matrixOfSymbols)
|
|||
Функция, преобразующая входящую матрицу символов в текст-заполнитель, например:
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
let matrix: [[Character]] = [
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
|
|
@ -151,9 +135,6 @@ print(placeholder)
|
|||
## - Примеры использования:
|
||||
|
||||
```swift
|
||||
import Foundation
|
||||
import TITextProcessing
|
||||
|
||||
// MARK: - Форматирование даты
|
||||
|
||||
let dateRegex = "(\\d{2})\\/?(\\d{2})"
|
||||
|
|
|
|||
|
|
@ -15,4 +15,8 @@
|
|||
|
||||
for module_name in $(cat ${SRCROOT}/project-scripts/ordered_modules_list.txt); do
|
||||
bundle exec pod repo push https://git.svc.touchin.ru/TouchInstinct/Podspecs ${SRCROOT}/${module_name}/${module_name}.podspec "$@" --allow-warnings
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue