From ce51820c9002ca26a8f2e122e8156dce9ac0458d Mon Sep 17 00:00:00 2001 From: robot-divkit Date: Tue, 4 Apr 2023 08:57:58 +0300 Subject: [PATCH] Release 24.0.0 --- Core/{Base => BasePublic}/Alignment.swift | 2 +- .../AllocatedUnfairLock.swift | 0 Core/{Base => BasePublic}/AnchoredPoint.swift | 0 .../ArrayExtensions.swift | 19 ++ .../AutodisposePool.swift | 0 Core/{Base => BasePublic}/BaseExports.swift | 2 +- .../CALayerExtensions.swift | 0 .../CAMediaTimingFunction.swift | 0 .../CATransaction+Extensions.swift | 0 .../CGColorExtensions.swift | 0 .../CGFloatExtensions.swift | 0 .../CGPointExtensions.swift | 0 .../CGRectExtensions.swift | 0 .../CGSizeExtensions.swift | 0 Core/{Base => BasePublic}/Cancellable.swift | 0 .../ColorExtensions.swift | 0 Core/{Base => BasePublic}/ColorHolder.swift | 0 Core/{Base => BasePublic}/Combine.swift | 0 .../ComparableExtension.swift | 0 Core/{Base => BasePublic}/DeferredValue.swift | 0 .../DictionaryExtensions.swift | 0 .../DimensionsFlipping.swift | 0 Core/{Base => BasePublic}/Disposable.swift | 0 .../EdgeInsets+Extensions.swift | 2 +- .../EdgeInsetsExtensions.swift | 2 +- Core/{Base => BasePublic}/Either.swift | 0 .../EncodableExtensions.swift | 0 .../{Base => BasePublic}/FilterProtocol.swift | 0 Core/{Base => BasePublic}/Functions.swift | 0 Core/{Base => BasePublic}/Future.swift | 0 Core/{Base => BasePublic}/GCD.swift | 0 Core/{Base => BasePublic}/Gradient.swift | 2 +- .../HTTPURLResponse+Extensions.swift | 0 Core/{Base => BasePublic}/Image+Crop.swift | 0 Core/{Base => BasePublic}/ImageBlur.swift | 0 Core/{Base => BasePublic}/ImageComposer.swift | 0 .../ImageContentMode.swift | 0 Core/{Base => BasePublic}/ImageCrop.swift | 0 Core/{Base => BasePublic}/ImageEffect.swift | 0 .../ImageExtensions.swift | 0 Core/{Base => BasePublic}/ImageFilters.swift | 0 .../{Base => BasePublic}/ImageGenerator.swift | 0 Core/{Base => BasePublic}/ImageHolder.swift | 0 .../ImagePlaceholder.swift | 2 +- .../IndexSetExtensions.swift | 0 .../InternalImageDescriptor.swift | 0 .../InvalidArgumentError.swift | 0 .../KeyValueDirectStoringSupporting.swift | 0 .../KeyValueStorage.swift | 0 .../KeyboardAppearance.swift | 0 Core/{Base => BasePublic}/Lazy.swift | 0 .../LinearGradientView+Layer.swift | 0 .../NSTimerExtensions.swift | 1 - .../NSURLExtensions.swift | 0 .../{Base => BasePublic}/NilImageHolder.swift | 0 .../{Base => BasePublic}/NonEmpty+Array.swift | 0 Core/{Base => BasePublic}/NonEmpty+Set.swift | 0 .../NonEmpty+String.swift | 0 Core/{Base => BasePublic}/NonEmpty.swift | 0 .../ObservableProperty.swift | 0 .../ObservableVariable.swift | 0 Core/{Base => BasePublic}/Observer.swift | 0 .../{Base => BasePublic}/OperationQueue.swift | 0 .../OptionalExtensions.swift | 0 .../PhysicalFeedbackGenerator.swift | 0 Core/{Base => BasePublic}/Promise.swift | 0 Core/{Base => BasePublic}/Property.swift | 0 .../RGBAColorExtensions.swift | 0 .../RadialGradientView.swift | 0 .../Range+Extensions.swift | 0 ...RangeReplaceableCollectionExtensions.swift | 0 Core/{Base => BasePublic}/RelativePoint.swift | 2 +- Core/{Base => BasePublic}/RelativeRect.swift | 2 +- Core/{Base => BasePublic}/RelativeSize.swift | 0 Core/{Base => BasePublic}/RelativeValue.swift | 0 Core/{Base => BasePublic}/Result.swift | 0 .../{Base => BasePublic}/ScrollDelegate.swift | 0 Core/{Base => BasePublic}/ScrollEdge.swift | 0 .../ScrollViewTrackable.swift | 0 .../{Base => BasePublic}/ScrollViewType.swift | 2 +- .../{Base => BasePublic}/ScrollingToTop.swift | 0 .../SequenceExtensions.swift | 0 .../SettingProperty.swift | 0 .../Signal+CombineLatest.swift | 0 Core/{Base => BasePublic}/Signal.swift | 0 Core/{Base => BasePublic}/SignalPipe.swift | 0 .../SingleValueCoder.swift | 0 .../{Base => BasePublic}/StatusBarStyle.swift | 0 .../String+Extensions.swift | 6 +- .../ThreadExtensions.swift | 0 Core/{Base => BasePublic}/Time.swift | 0 Core/{Base => BasePublic}/TintMode.swift | 0 .../TupleExtensions.swift | 0 .../UIScrollView+Extensions.swift | 0 .../UIViewExtensions.swift | 0 .../URLResourceRequesting.swift | 0 .../UnsignedIntegerExtenstions.swift | 0 Core/{Base => BasePublic}/UrlOpener.swift | 0 Core/{Base => BasePublic}/Variable.swift | 0 .../ViewImageHolder.swift | 0 .../{Base => BasePublic}/WeakCollection.swift | 14 +- Core/{Base => BasePublic}/iOS.swift | 0 Core/{Base => BasePublic}/weakify.swift | 0 .../{BaseTiny => BaseTinyPublic}/Action.swift | 0 .../ArrayBuilder.swift | 0 .../{BaseTiny => BaseTinyPublic}/Atomic.swift | 0 .../CFCasting.swift | 0 Core/{BaseTiny => BaseTinyPublic}/Clamp.swift | 0 .../CollectionExtensions.swift | 0 .../ColorExtensions.swift | 0 .../DictionaryExtensions.swift | 0 .../FloatingPointComparison.swift | 0 .../JSONObject.swift | 0 .../Memoization.swift | 0 .../Modifier.swift | 0 .../NSKeyedArchiver+Legacy.swift | 0 .../NSKeyedUnarchiver+Legacy.swift | 0 .../OAuthToken.swift | 0 .../PersistentStorage.swift | 0 .../RGBAColor.swift | 0 .../{BaseTiny => BaseTinyPublic}/RWLock.swift | 0 Core/{BaseTiny => BaseTinyPublic}/Radix.swift | 0 .../{BaseTiny => BaseTinyPublic}/Result.swift | 0 .../SequenceExtensions.swift | 0 .../StringExtensions.swift | 0 .../{BaseTiny => BaseTinyPublic}/Tagged.swift | 0 .../URLExtensions.swift | 0 Core/{BaseTiny => BaseTinyPublic}/iOS.swift | 0 .../AccessibilityElement.swift | 0 .../AccessibilityElementExtensions.swift | 0 .../AccessibilityPriorities.swift | 0 .../ActionSheetModel.swift | 0 .../ActionSheetUI.swift | 0 .../AlertButton.swift | 0 .../{BaseUI => BaseUIPublic}/AlertModel.swift | 0 .../AlertTextField.swift | 0 Core/{BaseUI => BaseUIPublic}/AlertUI.swift | 0 .../AttributedStringLayout.swift | 0 .../BackgroundAttribute.swift | 0 .../BezierCurve.swift | 0 .../BorderAttribute.swift | 0 .../CAAnimationExtensions.swift | 0 .../CGAffineTransformExtensions.swift | 0 .../CGColorExtensions.swift | 2 +- .../CGContextExtensions.swift | 2 +- .../CGFloatExtensions.swift | 2 +- .../CGPointExtensions.swift | 0 .../CGRectExtensions.swift | 2 +- .../CGSizeExtensions.swift | 2 +- .../EdgeInsetsExtensions.swift | 2 +- .../FontExtensions.swift | 2 +- .../FontSettings.swift | 0 .../FontSpecifying.swift | 2 +- .../ImageExtensions.swift | 2 +- Core/{BaseUI => BaseUIPublic}/Label.swift | 2 +- .../NSAttributedStringExtensions.swift | 2 +- .../PublicInterfaces.swift | 2 +- .../{BaseUI => BaseUIPublic}/SideInsets.swift | 0 .../StringExtensions.swift | 2 +- Core/{BaseUI => BaseUIPublic}/Typo.swift | 2 +- .../UIDeviceExtensions.swift | 0 .../UIImageExtensions.swift | 4 +- .../UIImageViewExtensions.swift | 0 .../UIMenuControllerExtensions.swift | 0 .../UserInterfaceStyle.swift | 0 .../CommonCore/ImageViewBackgroundModel.swift | 1 + .../CacheRecord.swift | 0 .../CacheStorage.swift | 0 .../CompletionAccumulating.swift | 0 .../CompletionAccumulator.swift | 0 .../CompoundScrollDelegate.swift | 0 .../ExclusiveTouchCollectionView.swift | 0 .../Exported.swift | 2 +- .../HTMLEntities.swift | 0 .../HTMLEntitiesResolver.swift | 0 .../HTMLParser.swift | 2 +- .../HTMLParserDelegate.swift | 0 .../HTMLTag.swift | 0 .../HTMLTaggedString.swift | 2 +- .../ImageContaining.swift | 0 .../ImageLayerLayout.swift | 0 .../ImageRedrawingStyle.swift | 2 +- .../ImageViewBackgroundModel.swift | 54 +++++ .../ImageViewProtocol.swift | 0 .../LRUCacheStorage.swift | 0 .../LRUMemoization.swift | 0 .../LinkedListOrderedDictionary.swift | 0 .../MetalImageView.swift | 2 +- .../NSAttributedStringExtensions.swift | 2 +- .../ObjectsReusability.swift | 0 .../OrderedDictionary.swift | 0 .../RemoteImageView.swift | 0 .../RemoteImageViewContainer.swift | 0 .../RemoteImageViewContentProtocol.swift | 0 .../Resetting.swift | 0 .../ScrollableContent.swift | 0 .../SizedItem.swift | 0 .../Theme.swift | 2 +- .../UIStyles.swift | 0 .../ViewProtocol.swift | 0 .../VisibleBoundsTracking.swift | 0 .../ActiveRequestsTracker.swift | 0 .../AsyncResourceRequester.swift | 2 +- .../AuthChallengeHandler.swift | 0 .../ChallengeHandling.swift | 0 .../DataExtensions.swift | 0 .../HTTPCode.swift | 0 .../HTTPErrors.swift | 0 .../HTTPHeaders.swift | 0 .../ImageHolderFactory.swift | 2 +- .../LocalImageProviding.swift | 2 +- .../NSErrorExtensions.swift | 0 .../NetworkActivityIndicatorController.swift | 0 .../NetworkSessionMetrics.swift | 0 .../NetworkURLResourceRequester.swift | 2 +- .../RemoteImageHolder.swift | 2 +- .../Resource.swift | 2 +- .../TimeTracking.swift | 0 .../URLRequestPerformer.swift | 2 +- .../URLRequestPerforming.swift | 2 +- .../URLSessionDelegateImpl.swift | 0 .../URLSessionTaskMetricsExtensions.swift | 0 .../URLTransform.swift | 0 .../iOS.swift | 0 DivKit/Actions/DivActionHandler.swift | 2 +- DivKit/Actions/DivActionIntent.swift | 2 +- DivKit/Actions/DivActionLogger.swift | 4 +- DivKit/Actions/DivActionURLHandler.swift | 84 +++++--- DivKit/Debug/Block+DebugInfo.swift | 4 +- DivKit/Debug/ErrorListView.swift | 6 +- DivKit/DivBlockModeling.swift | 2 +- DivKit/DivBlockModelingActionContext.swift | 4 +- DivKit/DivBlockModelingContext.swift | 8 +- DivKit/DivErrorsStorage.swift | 2 +- DivKit/DivExtensionHandler.swift | 4 +- DivKit/DivKitComponents.swift | 8 +- DivKit/DivKitInfo.swift | 2 +- DivKit/DivStatePath.swift | 2 +- DivKit/DivVisibilityCounter.swift | 2 +- .../CalcExpression/AnyCalcExpression.swift | 17 +- .../CalcExpression/CalcExpression.swift | 28 ++- DivKit/Expressions/CalcExpression/Value.swift | 22 +- DivKit/Expressions/ExpressionLink.swift | 2 +- DivKit/Expressions/ExpressionResolver.swift | 2 +- .../Expressions/Functions/CastFunctions.swift | 2 +- .../Functions/ColorFunctions.swift | 2 +- .../Functions/DatetimeFunctions.swift | 2 +- DivKit/Expressions/Functions/Function.swift | 2 +- .../Expressions/Functions/MathFunctions.swift | 40 +++- .../Serialization/DictionaryExtensions.swift | 3 +- .../Serialization/Expression+Helpers.swift | 2 +- .../Expression+ValidSerializationValue.swift | 2 +- .../Serialization/FieldExtensions.swift | 2 +- DivKit/Extensions/ArrayExtensions.swift | 2 +- .../DivAbsoluteEdgeInsetsExtensions.swift | 2 +- .../DivAccessibilityExtensions.swift | 4 +- DivKit/Extensions/DivActionBase.swift | 2 +- DivKit/Extensions/DivActionExtensions.swift | 2 +- .../Extensions/DivAnimationExtensions.swift | 2 +- .../DivAppearanceTransitionExtensions.swift | 2 +- .../Extensions/DivBackgroundExtensions.swift | 6 +- .../DivBase/DivBaseExtensions.swift | 6 +- .../DivChangeTransitionExtensions.swift | 2 +- .../Extensions/DivContainerExtensions.swift | 2 +- .../DivCustom/DivCustomExtensions.swift | 2 +- .../DivData/DivDataExtensions.swift | 2 +- .../DivData/DivDataPatchExtensions.swift | 2 +- .../DivDrawable/DivDrawableExtensions.swift | 2 +- .../DivDrawable/DivShapeExtensions.swift | 2 +- .../Extensions/DivEdgeInsetsExtensions.swift | 4 +- DivKit/Extensions/DivFilterExtensions.swift | 2 +- .../Extensions/DivFontWeightExtensions.swift | 2 +- DivKit/Extensions/DivGalleryExtensions.swift | 9 +- DivKit/Extensions/DivGalleryProtocol.swift | 4 +- DivKit/Extensions/DivGridExtensions.swift | 2 +- .../DivImage/DivGifImageExtensions.swift | 2 +- .../DivImage/DivImageContentMode.swift | 2 +- .../DivImage/DivImageExtensions.swift | 6 +- .../DivImage/DivImageProtocol.swift | 2 +- .../Extensions/DivIndicatorExtensions.swift | 2 +- DivKit/Extensions/DivInputExtensions.swift | 69 +----- DivKit/Extensions/DivPagerExtensions.swift | 4 +- DivKit/Extensions/DivSizeExtensions.swift | 2 +- DivKit/Extensions/DivSizeUnitExtensions.swift | 2 +- DivKit/Extensions/DivSliderExtensions.swift | 4 +- DivKit/Extensions/DivStateExtensions.swift | 2 +- DivKit/Extensions/DivTabsExtensions.swift | 4 +- DivKit/Extensions/DivTextExtensions.swift | 6 +- .../DivVisibilityActionExtensions.swift | 2 +- DivKit/Extensions/GradientExtentions.swift | 4 +- .../Extensions/RelativeValueExtensions.swift | 2 +- DivKit/Patches/DivPatchDownloader.swift | 2 +- DivKit/Patches/DivPatchProvider.swift | 2 +- DivKit/RunLoopCardUpdateAggregator.swift | 4 +- DivKit/States/DivStateInterceptor.swift | 2 +- DivKit/States/DivStateManager.swift | 2 +- DivKit/Templates/DivTemplates.swift | 2 +- DivKit/Timers/DivTimerController.swift | 2 +- DivKit/Timers/DivTimerStrorage.swift | 2 +- DivKit/Variables/DivTriggersStorage.swift | 8 +- DivKit/Variables/DivVariablesStorage.swift | 71 +++---- .../generated_sources/BooleanVariable.swift | 2 +- .../BooleanVariableTemplate.swift | 2 +- DivKit/generated_sources/ColorVariable.swift | 2 +- .../ColorVariableTemplate.swift | 2 +- DivKit/generated_sources/Div.swift | 2 +- .../DivAbsoluteEdgeInsets.swift | 2 +- .../DivAbsoluteEdgeInsetsTemplate.swift | 2 +- .../generated_sources/DivAccessibility.swift | 2 +- .../DivAccessibilityTemplate.swift | 2 +- DivKit/generated_sources/DivAction.swift | 2 +- .../generated_sources/DivActionTemplate.swift | 2 +- .../DivAlignmentHorizontal.swift | 2 +- .../DivAlignmentVertical.swift | 2 +- DivKit/generated_sources/DivAnimation.swift | 2 +- .../DivAnimationInterpolator.swift | 2 +- .../DivAnimationTemplate.swift | 2 +- .../DivAppearanceSetTransition.swift | 2 +- .../DivAppearanceSetTransitionTemplate.swift | 2 +- .../DivAppearanceTransition.swift | 2 +- .../DivAppearanceTransitionTemplate.swift | 2 +- DivKit/generated_sources/DivAspect.swift | 2 +- .../generated_sources/DivAspectTemplate.swift | 2 +- DivKit/generated_sources/DivBackground.swift | 2 +- .../DivBackgroundTemplate.swift | 2 +- DivKit/generated_sources/DivBase.swift | 2 +- DivKit/generated_sources/DivBlendMode.swift | 2 +- DivKit/generated_sources/DivBlur.swift | 2 +- .../generated_sources/DivBlurTemplate.swift | 2 +- DivKit/generated_sources/DivBorder.swift | 2 +- .../generated_sources/DivBorderTemplate.swift | 2 +- .../DivChangeBoundsTransition.swift | 2 +- .../DivChangeBoundsTransitionTemplate.swift | 2 +- .../DivChangeSetTransition.swift | 2 +- .../DivChangeSetTransitionTemplate.swift | 2 +- .../DivChangeTransition.swift | 2 +- .../DivChangeTransitionTemplate.swift | 2 +- DivKit/generated_sources/DivCircleShape.swift | 26 +-- .../DivCircleShapeTemplate.swift | 51 +---- DivKit/generated_sources/DivContainer.swift | 2 +- .../DivContainerTemplate.swift | 2 +- .../generated_sources/DivCornersRadius.swift | 2 +- .../DivCornersRadiusTemplate.swift | 2 +- DivKit/generated_sources/DivCount.swift | 2 +- .../generated_sources/DivCountTemplate.swift | 2 +- DivKit/generated_sources/DivCustom.swift | 2 +- .../generated_sources/DivCustomTemplate.swift | 2 +- DivKit/generated_sources/DivData.swift | 2 +- .../generated_sources/DivDataTemplate.swift | 2 +- .../DivDefaultIndicatorItemPlacement.swift | 2 +- ...efaultIndicatorItemPlacementTemplate.swift | 2 +- DivKit/generated_sources/DivDimension.swift | 2 +- .../DivDimensionTemplate.swift | 2 +- .../DivDownloadCallbacks.swift | 2 +- .../DivDownloadCallbacksTemplate.swift | 2 +- DivKit/generated_sources/DivDrawable.swift | 2 +- .../DivDrawableTemplate.swift | 2 +- DivKit/generated_sources/DivEdgeInsets.swift | 2 +- .../DivEdgeInsetsTemplate.swift | 2 +- DivKit/generated_sources/DivExtension.swift | 2 +- .../DivExtensionTemplate.swift | 2 +- .../generated_sources/DivFadeTransition.swift | 2 +- .../DivFadeTransitionTemplate.swift | 2 +- DivKit/generated_sources/DivFilter.swift | 2 +- .../generated_sources/DivFilterTemplate.swift | 2 +- DivKit/generated_sources/DivFixedCount.swift | 2 +- .../DivFixedCountTemplate.swift | 2 +- .../DivFixedLengthInputMask.swift | 2 +- .../DivFixedLengthInputMaskTemplate.swift | 2 +- DivKit/generated_sources/DivFixedSize.swift | 2 +- .../DivFixedSizeTemplate.swift | 2 +- DivKit/generated_sources/DivFocus.swift | 2 +- .../generated_sources/DivFocusTemplate.swift | 2 +- DivKit/generated_sources/DivFontFamily.swift | 2 +- DivKit/generated_sources/DivFontWeight.swift | 2 +- DivKit/generated_sources/DivGallery.swift | 2 +- .../DivGalleryTemplate.swift | 2 +- DivKit/generated_sources/DivGifImage.swift | 2 +- .../DivGifImageTemplate.swift | 2 +- DivKit/generated_sources/DivGrid.swift | 2 +- .../generated_sources/DivGridTemplate.swift | 2 +- DivKit/generated_sources/DivImage.swift | 2 +- .../DivImageBackground.swift | 2 +- .../DivImageBackgroundTemplate.swift | 2 +- DivKit/generated_sources/DivImageScale.swift | 2 +- .../generated_sources/DivImageTemplate.swift | 2 +- DivKit/generated_sources/DivIndicator.swift | 2 +- .../DivIndicatorItemPlacement.swift | 2 +- .../DivIndicatorItemPlacementTemplate.swift | 2 +- .../DivIndicatorTemplate.swift | 2 +- .../generated_sources/DivInfinityCount.swift | 2 +- .../DivInfinityCountTemplate.swift | 2 +- DivKit/generated_sources/DivInput.swift | 52 ++--- DivKit/generated_sources/DivInputMask.swift | 2 +- .../DivInputMaskTemplate.swift | 78 ------- DivKit/generated_sources/DivInputMethod.swift | 42 ---- .../DivInputMethodTemplate.swift | 101 --------- .../generated_sources/DivInputTemplate.swift | 36 +--- .../generated_sources/DivKeyboardInput.swift | 56 ----- .../DivKeyboardInputTemplate.swift | 83 -------- DivKit/generated_sources/DivLineStyle.swift | 2 +- .../generated_sources/DivLinearGradient.swift | 2 +- .../DivLinearGradientTemplate.swift | 2 +- .../DivMatchParentSize.swift | 2 +- .../DivMatchParentSizeTemplate.swift | 2 +- .../DivNeighbourPageSize.swift | 2 +- .../DivNeighbourPageSizeTemplate.swift | 2 +- .../DivNinePatchBackground.swift | 2 +- .../DivNinePatchBackgroundTemplate.swift | 2 +- DivKit/generated_sources/DivPageSize.swift | 2 +- .../DivPageSizeTemplate.swift | 2 +- DivKit/generated_sources/DivPager.swift | 2 +- .../DivPagerLayoutMode.swift | 2 +- .../DivPagerLayoutModeTemplate.swift | 2 +- .../generated_sources/DivPagerTemplate.swift | 2 +- DivKit/generated_sources/DivPatch.swift | 2 +- .../generated_sources/DivPatchTemplate.swift | 2 +- .../generated_sources/DivPercentageSize.swift | 2 +- .../DivPercentageSizeTemplate.swift | 2 +- DivKit/generated_sources/DivPivot.swift | 2 +- DivKit/generated_sources/DivPivotFixed.swift | 2 +- .../DivPivotFixedTemplate.swift | 2 +- .../DivPivotPercentage.swift | 2 +- .../DivPivotPercentageTemplate.swift | 2 +- .../generated_sources/DivPivotTemplate.swift | 2 +- DivKit/generated_sources/DivPoint.swift | 2 +- .../generated_sources/DivPointTemplate.swift | 2 +- .../generated_sources/DivRadialGradient.swift | 2 +- .../DivRadialGradientCenter.swift | 2 +- .../DivRadialGradientCenterTemplate.swift | 2 +- .../DivRadialGradientFixedCenter.swift | 2 +- ...DivRadialGradientFixedCenterTemplate.swift | 2 +- .../DivRadialGradientRadius.swift | 2 +- .../DivRadialGradientRadiusTemplate.swift | 2 +- .../DivRadialGradientRelativeCenter.swift | 2 +- ...RadialGradientRelativeCenterTemplate.swift | 2 +- .../DivRadialGradientRelativeRadius.swift | 2 +- ...RadialGradientRelativeRadiusTemplate.swift | 2 +- .../DivRadialGradientTemplate.swift | 2 +- .../DivRoundedRectangleShape.swift | 2 +- .../DivRoundedRectangleShapeTemplate.swift | 2 +- .../DivScaleTransition.swift | 2 +- .../DivScaleTransitionTemplate.swift | 2 +- .../generated_sources/DivSelectionInput.swift | 92 -------- .../DivSelectionInputTemplate.swift | 201 ------------------ DivKit/generated_sources/DivSeparator.swift | 2 +- .../DivSeparatorTemplate.swift | 2 +- DivKit/generated_sources/DivShadow.swift | 2 +- .../generated_sources/DivShadowTemplate.swift | 2 +- DivKit/generated_sources/DivShape.swift | 2 +- .../generated_sources/DivShapeDrawable.swift | 2 +- .../DivShapeDrawableTemplate.swift | 2 +- .../generated_sources/DivShapeTemplate.swift | 2 +- DivKit/generated_sources/DivSize.swift | 2 +- .../generated_sources/DivSizeTemplate.swift | 2 +- DivKit/generated_sources/DivSizeUnit.swift | 2 +- .../DivSlideTransition.swift | 2 +- .../DivSlideTransitionTemplate.swift | 2 +- DivKit/generated_sources/DivSlider.swift | 2 +- .../generated_sources/DivSliderTemplate.swift | 2 +- .../DivSolidBackground.swift | 2 +- .../DivSolidBackgroundTemplate.swift | 2 +- DivKit/generated_sources/DivState.swift | 2 +- .../generated_sources/DivStateTemplate.swift | 2 +- .../DivStretchIndicatorItemPlacement.swift | 2 +- ...tretchIndicatorItemPlacementTemplate.swift | 2 +- DivKit/generated_sources/DivStroke.swift | 2 +- .../generated_sources/DivStrokeTemplate.swift | 2 +- DivKit/generated_sources/DivTabs.swift | 2 +- .../generated_sources/DivTabsTemplate.swift | 2 +- DivKit/generated_sources/DivTemplate.swift | 2 +- DivKit/generated_sources/DivText.swift | 2 +- .../generated_sources/DivTextGradient.swift | 2 +- .../DivTextGradientTemplate.swift | 2 +- .../DivTextRangeBackground.swift | 2 +- .../DivTextRangeBackgroundTemplate.swift | 2 +- .../DivTextRangeBorder.swift | 2 +- .../DivTextRangeBorderTemplate.swift | 2 +- .../generated_sources/DivTextTemplate.swift | 2 +- DivKit/generated_sources/DivTimer.swift | 2 +- .../generated_sources/DivTimerTemplate.swift | 2 +- DivKit/generated_sources/DivTooltip.swift | 2 +- .../DivTooltipTemplate.swift | 2 +- DivKit/generated_sources/DivTransform.swift | 2 +- .../DivTransformTemplate.swift | 2 +- .../generated_sources/DivTransitionBase.swift | 2 +- .../DivTransitionSelector.swift | 2 +- .../DivTransitionTrigger.swift | 2 +- DivKit/generated_sources/DivTrigger.swift | 2 +- .../DivTriggerTemplate.swift | 2 +- DivKit/generated_sources/DivVariable.swift | 2 +- .../DivVariableTemplate.swift | 2 +- DivKit/generated_sources/DivVisibility.swift | 2 +- .../DivVisibilityAction.swift | 2 +- .../DivVisibilityActionTemplate.swift | 2 +- .../DivWrapContentSize.swift | 2 +- .../DivWrapContentSizeTemplate.swift | 2 +- .../generated_sources/IntegerVariable.swift | 2 +- .../IntegerVariableTemplate.swift | 2 +- DivKit/generated_sources/NumberVariable.swift | 2 +- .../NumberVariableTemplate.swift | 2 +- DivKit/generated_sources/StringVariable.swift | 2 +- .../StringVariableTemplate.swift | 2 +- DivKit/generated_sources/UrlVariable.swift | 2 +- .../UrlVariableTemplate.swift | 2 +- .../Animations/AnimatableView.swift | 2 +- ...ationBlockView+UIViewRenderableBlock.swift | 2 +- .../Animations/AnimationBlockView.swift | 2 +- .../Animations/AnimationHolder.swift | 2 +- .../Lottie/LottieAnimationBlock.swift | 4 +- .../Lottie/LottieExtensionHandler.swift | 4 +- .../Animations/RemoteAnimationHolder.swift | 4 +- ...AnimationBlock+UIViewRenderableBlock.swift | 2 +- .../Animations/Rive/RiveAnimationBlock.swift | 2 +- .../CustomImagePreviewExtensionHandler.swift | 2 +- .../ImageExtensionHandler.swift | 2 +- .../ImageThemeExtensionHandler.swift | 2 +- .../TextExtensionHandler.swift | 4 +- .../ShimmerImagePreviewExtensions.swift | 2 +- DivKitExtensions/Shimmer/ShimmerStyle.swift | 2 +- .../SizeProviderBlock+UIViewRenderable.swift | 2 +- .../SizeProviderExtensionHandler.swift | 2 +- LayoutKit/Interface/CommonHandler.swift | 2 +- LayoutKit/Interface/UIElementPath.swift | 2 +- LayoutKit/Interface/UserInterfaceAction.swift | 4 +- LayoutKit/LayoutKit/Base/UILink.swift | 2 +- LayoutKit/LayoutKit/Binding.swift | 8 +- .../Blocks/AccessibilityContaining.swift | 2 +- .../Anchor/AnchorBlock+UIViewRenderable.swift | 2 +- .../LayoutKit/Blocks/Anchor/AnchorBlock.swift | 2 +- .../Blocks/Anchor/AnchorBlockLayout.swift | 2 +- .../Blocks/AnimatableImageBlock.swift | 4 +- .../Aspect/AspectBlock+UIViewRenderable.swift | 2 +- .../LayoutKit/Blocks/BackgroundBlock.swift | 2 +- .../Blocks/Block+Accessibility.swift | 2 +- .../LayoutKit/Blocks/Block+Debugging.swift | 2 +- LayoutKit/LayoutKit/Blocks/Block.swift | 2 +- .../LayoutKit/Blocks/BlockAlignment2D.swift | 2 +- LayoutKit/LayoutKit/Blocks/BlockBorder.swift | 2 +- LayoutKit/LayoutKit/Blocks/BlockError.swift | 2 +- .../Blocks/BlockTooltip+Layout.swift | 2 +- LayoutKit/LayoutKit/Blocks/BlockTooltip.swift | 2 +- .../LayoutKit/Blocks/BlockWithLayout.swift | 2 +- .../Blocks/BlocksStateExtensions.swift | 2 +- .../Blocks/BoundaryTrait+CALayer.swift | 12 +- .../LayoutKit/Blocks/BoundaryTrait.swift | 2 +- .../Blocks/BoundaryTraitExtensions.swift | 2 +- .../Container/ConstrainedBlockMeasure.swift | 2 +- .../Blocks/Container/ContainerBlock.swift | 4 +- .../Container/ContainerBlockExtensions.swift | 4 +- .../Container/ContainerBlockLayout.swift | 2 +- .../Blocks/Container/WrapLayoutGroups.swift | 27 ++- .../LayoutKit/Blocks/DebugInfoBlock.swift | 2 +- .../Decorations/Block+Decorations.swift | 4 +- .../Blocks/Decorations/ContextMenu.swift | 4 +- .../Blocks/Decorations/DecoratingBlock.swift | 4 +- .../Blocks/Decorations/LongTapActions.swift | 2 +- .../Blocks/DetachableAnimationBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/EmptyBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/GalleryBlock.swift | 12 +- .../LayoutKit/Blocks/GradientBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/Grid/Grid.swift | 2 +- .../LayoutKit/Blocks/Grid/GridBlock.swift | 2 +- .../LayoutKit/Blocks/Grid/GridLayout.swift | 2 +- .../LayoutKit/Blocks/ImageBaseBlock.swift | 2 +- .../LayoutKit/Blocks/ImageBlock+Copy.swift | 2 +- LayoutKit/LayoutKit/Blocks/ImageBlock.swift | 4 +- .../ContainerBlock+ImageRenderableBlock.swift | 2 +- .../ImageBlock+ImageRenderableBlock.swift | 2 +- .../ImageRenderableBlock.swift | 2 +- .../LayredBlock+ImageRenderableBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/LaidOutBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/LayeredBlock.swift | 2 +- .../LayoutKit/Blocks/LayeredBlockLayout.swift | 2 +- LayoutKit/LayoutKit/Blocks/MaskedBlock.swift | 2 +- .../LayoutKit/Blocks/PageControlBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/PagerBlock.swift | 2 +- .../LayoutKit/Blocks/PinchToZoomBlock.swift | 2 +- .../Blocks/ResizableBlockMeasure.swift | 2 +- LayoutKit/LayoutKit/Blocks/RoundedRect.swift | 2 +- .../LayoutKit/Blocks/SeparatorBlock.swift | 2 +- .../LayoutKit/Blocks/Shadow/BlockShadow.swift | 2 +- .../LayoutKit/Blocks/Shadow/ShadedBlock.swift | 2 +- .../Blocks/SizeForwardingBlock.swift | 2 +- .../Slider/SliderBlock+UIViewRenderable.swift | 2 +- .../LayoutKit/Blocks/Slider/SliderBlock.swift | 2 +- .../LayoutKit/Blocks/Slider/SliderModel.swift | 2 +- .../LayoutKit/Blocks/Slider/SliderView.swift | 2 +- LayoutKit/LayoutKit/Blocks/StateBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/SwitchBlock.swift | 6 +- .../Blocks/SwitchableContainerBlock.swift | 4 +- LayoutKit/LayoutKit/Blocks/TabsBlock.swift | 2 +- .../LayoutKit/Blocks/TextBlock+Copy.swift | 2 +- LayoutKit/LayoutKit/Blocks/TextBlock.swift | 4 +- .../Blocks/TextFieldBlock+Debugging.swift | 4 +- .../LayoutKit/Blocks/TextFieldBlock.swift | 6 +- .../Blocks/TextInputBlock+Debugging.swift | 6 +- .../LayoutKit/Blocks/TextInputBlock.swift | 57 ++--- .../Blocks/TransitioningAnimation.swift | 2 +- .../LayoutKit/Blocks/TransitioningBlock.swift | 2 +- LayoutKit/LayoutKit/Blocks/VideoBlock.swift | 4 +- .../LayoutKit/Blocks/VisibilityAction.swift | 2 +- LayoutKit/LayoutKit/Blocks/WrapperBlock.swift | 2 +- LayoutKit/LayoutKit/GenericViewBlock.swift | 2 +- LayoutKit/LayoutKit/TooltipFactory.swift | 4 +- LayoutKit/LayoutKit/Types.swift | 4 +- .../Actions/AnalyticsClickEventHandling.swift | 2 +- .../UI/Actions/CommonHandlerExtensions.swift | 2 +- .../GalleryScrollEventHandling.swift | 2 +- .../LayoutKit/UI/Actions/MenuExtensions.swift | 2 +- .../UI/Actions/PagerEventHandling.swift | 2 +- .../UI/Actions/TooltipEventPerforming.swift | 2 +- .../UIActionEventPerformingAdapter.swift | 2 +- .../UI/Base/GenericCollectionLayout.swift | 4 +- .../Base/GenericCollectionReusableView.swift | 2 +- .../UI/Base/GenericCollectionViewCell.swift | 4 +- .../GenericCollectionViewDataSource.swift | 2 +- .../UI/Base/GenericCollectionViewLayout.swift | 2 +- .../IndicatorStateAnimator.swift | 2 +- .../PageIndicatorConfiguration.swift | 2 +- .../PageIndicator/PageIndicatorLayer.swift | 2 +- .../PageIndicatorLayerParams.swift | 12 +- .../PageIndicator/PageIndicatorView.swift | 2 +- ...crollableContentPager+ScrollDelegate.swift | 2 +- .../UI/Base/ScrollableContentPager.swift | 2 +- ...ssibilityBlock+UIViewRenderableBlock.swift | 6 +- ...ableImageBlock+UIViewRenderableBlock.swift | 2 +- .../UI/Blocks/Array+UIViewRenderable.swift | 2 +- ...ackgroundBlock+UIViewRenderableBlock.swift | 2 +- .../UI/Blocks/BlockViewProtocol.swift | 2 +- ...ContainerBlock+UIViewRenderableBlock.swift | 6 +- ...DebugInfoBlock+UIViewRenderableBlock.swift | 2 +- ...ecoratingBlock+UIViewRenderableBlock.swift | 19 +- ...AnimationBlock+UIViewRenderableBlock.swift | 2 +- .../EffectiveBackgroundColorProviding.swift | 2 +- .../EmptyBlock+UIViewRenderableBlock.swift | 2 +- .../GalleryBlock+UIViewRenderableBlock.swift | 2 +- ...nericViewBlock+UIViewRenderableBlock.swift | 2 +- .../GridBlock+UIViewRenderableBlock.swift | 2 +- .../ImageBlock+UIViewRenderableBlock.swift | 2 +- .../LaidOutBlock+UIViewRenderableBlock.swift | 2 +- .../LayeredBlock+UIViewRenderableBlock.swift | 2 +- .../Blocks/MaskedBlock+UIViewRenderable.swift | 2 +- ...geControlBlock+UIViewRenderableBlock.swift | 2 +- .../PagerBlock+UIViewRenderableBlock.swift | 5 +- ...nchToZoomBlock+UIViewRenderableBlock.swift | 2 +- .../UI/Blocks/ReferenceEquatable.swift | 2 +- .../UI/Blocks/RenderingDelegate.swift | 2 +- ...SeparatorBlock+UIViewRenderableBlock.swift | 2 +- .../ShadedBlock+UIViewRenderableBlock.swift | 2 +- .../StateBlock+UIViewRenderableBlock.swift | 2 +- ...SwipeContainerBlock+UIViewRenderable.swift | 6 +- .../SwitchBlock+UIViewRenderableBlock.swift | 4 +- ...ContainerBlock+UIViewRenderableBlock.swift | 4 +- .../TabsBlock+UIViewRenderableBlock.swift | 2 +- .../TextBlock+UIViewRenderableBlock.swift | 4 +- ...TextFieldBlock+UIViewRenderableBlock.swift | 4 +- ...TextInputBlock+UIViewRenderableBlock.swift | 66 +----- ...sitioningBlock+UIViewRenderableBlock.swift | 4 +- .../UIView+TransitioningAnimation.swift | 2 +- .../UI/Blocks/UIViewRenderable.swift | 2 +- .../UIViewRenderableBlockWithLayout.swift | 2 +- .../VideoBlock+UIViewRenderableBlock.swift | 2 +- .../UI/Views/AnimatingGradientView.swift | 2 +- .../UI/Views/Background+UIViewRendering.swift | 2 +- .../LayoutKit/UI/Views/BoxShadowView.swift | 2 +- .../UI/Views/ContextMenuDelegate.swift | 2 +- .../LayoutKit/UI/Views/GalleryView.swift | 29 ++- .../UI/Views/NinePatchImageView.swift | 4 +- .../UI/Views/SegmentedProgressView.swift | 2 +- .../Views/TabbedPages/TabContentsView.swift | 10 +- .../TabListSelectionDataSourceImpl.swift | 2 +- .../UI/Views/TabbedPages/TabListView.swift | 6 +- .../TabbedPages/TabListViewDataSource.swift | 2 +- .../TabbedPages/TabListViewDelegate.swift | 2 +- .../TabbedPages/TabSelectionWireframe.swift | 2 +- .../TabbedPages/TabTitlesViewModel.swift | 2 +- .../Views/TabbedPages/TabbedPagesView.swift | 2 +- .../UI/Views/URLActionHandlingView.swift | 2 +- .../UI/Views/ViewWithContentInsets.swift | 2 +- .../LayoutKit/UI/Views/ViewWithShadow.swift | 2 +- .../VisibleBoundsTrackingCollectionView.swift | 4 +- .../LayoutKit/ViewModels/Background.swift | 2 +- .../ViewModels/BackgroundImage.swift | 4 +- .../ViewModels/GalleryViewLayout.swift | 4 +- .../ViewModels/GalleryViewMetrics.swift | 4 +- .../ViewModels/GalleryViewModel.swift | 2 +- .../ViewModels/GalleryViewState.swift | 65 +++--- .../LayoutKit/ViewModels/InsetMode.swift | 4 +- .../LayoutKit/ViewModels/NinePatchImage.swift | 2 +- .../ViewModels/PagerViewLayout.swift | 4 +- .../LayoutKit/ViewModels/PagerViewState.swift | 2 +- .../TabbedPages/TabContentsViewLayout.swift | 4 +- .../TabbedPages/TabContentsViewModel.swift | 2 +- .../ViewModels/TabbedPages/TabError.swift | 2 +- .../TabInterimItemExtensions.swift | 2 +- .../TabbedPages/TabListViewModel.swift | 4 +- .../TabbedPages/TabPageViewModel.swift | 2 +- .../TabbedPages/TabSeparatorStyle.swift | 2 +- .../TabbedPages/TabTitleStyle.swift | 4 +- .../TabbedPages/TabTitleViewModel.swift | 2 +- .../ViewModels/TabbedPages/TabViewModel.swift | 2 +- .../ViewModels/TabbedPages/TabViewState.swift | 2 +- .../VisibilityActionPerformer.swift | 2 +- .../VisibilityActionPerformers.swift | 2 +- Package.swift | 42 ++-- Serialization/DeserializationError.swift | 2 +- Serialization/DeserializationResult.swift | 2 +- Serialization/Dictionary+Serialization.swift | 64 +----- Serialization/Serializable.swift | 2 +- .../SettingProperty+Serializable.swift | 2 +- Serialization/Validation.swift | 14 +- Serialization/ValueDeserialization.swift | 18 +- TemplatesSupport/Context.swift | 2 - TemplatesSupport/Field.swift | 169 +-------------- TemplatesSupport/ParsingMode.swift | 10 - .../SerializationExtensions.swift | 156 +------------- TemplatesSupport/TemplateError.swift | 5 +- TemplatesSupport/TemplateToType.swift | 10 +- TemplatesSupport/TemplateValue.swift | 2 +- 720 files changed, 1048 insertions(+), 2168 deletions(-) rename Core/{Base => BasePublic}/Alignment.swift (98%) rename Core/{Base => BasePublic}/AllocatedUnfairLock.swift (100%) rename Core/{Base => BasePublic}/AnchoredPoint.swift (100%) rename Core/{Base => BasePublic}/ArrayExtensions.swift (93%) rename Core/{Base => BasePublic}/AutodisposePool.swift (100%) rename Core/{Base => BasePublic}/BaseExports.swift (61%) rename Core/{Base => BasePublic}/CALayerExtensions.swift (100%) rename Core/{Base => BasePublic}/CAMediaTimingFunction.swift (100%) rename Core/{Base => BasePublic}/CATransaction+Extensions.swift (100%) rename Core/{Base => BasePublic}/CGColorExtensions.swift (100%) rename Core/{Base => BasePublic}/CGFloatExtensions.swift (100%) rename Core/{Base => BasePublic}/CGPointExtensions.swift (100%) rename Core/{Base => BasePublic}/CGRectExtensions.swift (100%) rename Core/{Base => BasePublic}/CGSizeExtensions.swift (100%) rename Core/{Base => BasePublic}/Cancellable.swift (100%) rename Core/{Base => BasePublic}/ColorExtensions.swift (100%) rename Core/{Base => BasePublic}/ColorHolder.swift (100%) rename Core/{Base => BasePublic}/Combine.swift (100%) rename Core/{Base => BasePublic}/ComparableExtension.swift (100%) rename Core/{Base => BasePublic}/DeferredValue.swift (100%) rename Core/{Base => BasePublic}/DictionaryExtensions.swift (100%) rename Core/{Base => BasePublic}/DimensionsFlipping.swift (100%) rename Core/{Base => BasePublic}/Disposable.swift (100%) rename Core/{Base => BasePublic}/EdgeInsets+Extensions.swift (98%) rename Core/{Base => BasePublic}/EdgeInsetsExtensions.swift (98%) rename Core/{Base => BasePublic}/Either.swift (100%) rename Core/{Base => BasePublic}/EncodableExtensions.swift (100%) rename Core/{Base => BasePublic}/FilterProtocol.swift (100%) rename Core/{Base => BasePublic}/Functions.swift (100%) rename Core/{Base => BasePublic}/Future.swift (100%) rename Core/{Base => BasePublic}/GCD.swift (100%) rename Core/{Base => BasePublic}/Gradient.swift (99%) rename Core/{Base => BasePublic}/HTTPURLResponse+Extensions.swift (100%) rename Core/{Base => BasePublic}/Image+Crop.swift (100%) rename Core/{Base => BasePublic}/ImageBlur.swift (100%) rename Core/{Base => BasePublic}/ImageComposer.swift (100%) rename Core/{Base => BasePublic}/ImageContentMode.swift (100%) rename Core/{Base => BasePublic}/ImageCrop.swift (100%) rename Core/{Base => BasePublic}/ImageEffect.swift (100%) rename Core/{Base => BasePublic}/ImageExtensions.swift (100%) rename Core/{Base => BasePublic}/ImageFilters.swift (100%) rename Core/{Base => BasePublic}/ImageGenerator.swift (100%) rename Core/{Base => BasePublic}/ImageHolder.swift (100%) rename Core/{Base => BasePublic}/ImagePlaceholder.swift (98%) rename Core/{Base => BasePublic}/IndexSetExtensions.swift (100%) rename Core/{Base => BasePublic}/InternalImageDescriptor.swift (100%) rename Core/{Base => BasePublic}/InvalidArgumentError.swift (100%) rename Core/{Base => BasePublic}/KeyValueDirectStoringSupporting.swift (100%) rename Core/{Base => BasePublic}/KeyValueStorage.swift (100%) rename Core/{Base => BasePublic}/KeyboardAppearance.swift (100%) rename Core/{Base => BasePublic}/Lazy.swift (100%) rename Core/{Base => BasePublic}/LinearGradientView+Layer.swift (100%) rename Core/{Base => BasePublic}/NSTimerExtensions.swift (99%) rename Core/{Base => BasePublic}/NSURLExtensions.swift (100%) rename Core/{Base => BasePublic}/NilImageHolder.swift (100%) rename Core/{Base => BasePublic}/NonEmpty+Array.swift (100%) rename Core/{Base => BasePublic}/NonEmpty+Set.swift (100%) rename Core/{Base => BasePublic}/NonEmpty+String.swift (100%) rename Core/{Base => BasePublic}/NonEmpty.swift (100%) rename Core/{Base => BasePublic}/ObservableProperty.swift (100%) rename Core/{Base => BasePublic}/ObservableVariable.swift (100%) rename Core/{Base => BasePublic}/Observer.swift (100%) rename Core/{Base => BasePublic}/OperationQueue.swift (100%) rename Core/{Base => BasePublic}/OptionalExtensions.swift (100%) rename Core/{Base => BasePublic}/PhysicalFeedbackGenerator.swift (100%) rename Core/{Base => BasePublic}/Promise.swift (100%) rename Core/{Base => BasePublic}/Property.swift (100%) rename Core/{Base => BasePublic}/RGBAColorExtensions.swift (100%) rename Core/{Base => BasePublic}/RadialGradientView.swift (100%) rename Core/{Base => BasePublic}/Range+Extensions.swift (100%) rename Core/{Base => BasePublic}/RangeReplaceableCollectionExtensions.swift (100%) rename Core/{Base => BasePublic}/RelativePoint.swift (99%) rename Core/{Base => BasePublic}/RelativeRect.swift (99%) rename Core/{Base => BasePublic}/RelativeSize.swift (100%) rename Core/{Base => BasePublic}/RelativeValue.swift (100%) rename Core/{Base => BasePublic}/Result.swift (100%) rename Core/{Base => BasePublic}/ScrollDelegate.swift (100%) rename Core/{Base => BasePublic}/ScrollEdge.swift (100%) rename Core/{Base => BasePublic}/ScrollViewTrackable.swift (100%) rename Core/{Base => BasePublic}/ScrollViewType.swift (99%) rename Core/{Base => BasePublic}/ScrollingToTop.swift (100%) rename Core/{Base => BasePublic}/SequenceExtensions.swift (100%) rename Core/{Base => BasePublic}/SettingProperty.swift (100%) rename Core/{Base => BasePublic}/Signal+CombineLatest.swift (100%) rename Core/{Base => BasePublic}/Signal.swift (100%) rename Core/{Base => BasePublic}/SignalPipe.swift (100%) rename Core/{Base => BasePublic}/SingleValueCoder.swift (100%) rename Core/{Base => BasePublic}/StatusBarStyle.swift (100%) rename Core/{Base => BasePublic}/String+Extensions.swift (98%) rename Core/{Base => BasePublic}/ThreadExtensions.swift (100%) rename Core/{Base => BasePublic}/Time.swift (100%) rename Core/{Base => BasePublic}/TintMode.swift (100%) rename Core/{Base => BasePublic}/TupleExtensions.swift (100%) rename Core/{Base => BasePublic}/UIScrollView+Extensions.swift (100%) rename Core/{Base => BasePublic}/UIViewExtensions.swift (100%) rename Core/{Base => BasePublic}/URLResourceRequesting.swift (100%) rename Core/{Base => BasePublic}/UnsignedIntegerExtenstions.swift (100%) rename Core/{Base => BasePublic}/UrlOpener.swift (100%) rename Core/{Base => BasePublic}/Variable.swift (100%) rename Core/{Base => BasePublic}/ViewImageHolder.swift (100%) rename Core/{Base => BasePublic}/WeakCollection.swift (90%) rename Core/{Base => BasePublic}/iOS.swift (100%) rename Core/{Base => BasePublic}/weakify.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Action.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/ArrayBuilder.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Atomic.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/CFCasting.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Clamp.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/CollectionExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/ColorExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/DictionaryExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/FloatingPointComparison.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/JSONObject.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Memoization.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Modifier.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/NSKeyedArchiver+Legacy.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/NSKeyedUnarchiver+Legacy.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/OAuthToken.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/PersistentStorage.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/RGBAColor.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/RWLock.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Radix.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Result.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/SequenceExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/StringExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/Tagged.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/URLExtensions.swift (100%) rename Core/{BaseTiny => BaseTinyPublic}/iOS.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AccessibilityElement.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AccessibilityElementExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AccessibilityPriorities.swift (100%) rename Core/{BaseUI => BaseUIPublic}/ActionSheetModel.swift (100%) rename Core/{BaseUI => BaseUIPublic}/ActionSheetUI.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AlertButton.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AlertModel.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AlertTextField.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AlertUI.swift (100%) rename Core/{BaseUI => BaseUIPublic}/AttributedStringLayout.swift (100%) rename Core/{BaseUI => BaseUIPublic}/BackgroundAttribute.swift (100%) rename Core/{BaseUI => BaseUIPublic}/BezierCurve.swift (100%) rename Core/{BaseUI => BaseUIPublic}/BorderAttribute.swift (100%) rename Core/{BaseUI => BaseUIPublic}/CAAnimationExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/CGAffineTransformExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/CGColorExtensions.swift (93%) rename Core/{BaseUI => BaseUIPublic}/CGContextExtensions.swift (90%) rename Core/{BaseUI => BaseUIPublic}/CGFloatExtensions.swift (98%) rename Core/{BaseUI => BaseUIPublic}/CGPointExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/CGRectExtensions.swift (95%) rename Core/{BaseUI => BaseUIPublic}/CGSizeExtensions.swift (98%) rename Core/{BaseUI => BaseUIPublic}/EdgeInsetsExtensions.swift (97%) rename Core/{BaseUI => BaseUIPublic}/FontExtensions.swift (99%) rename Core/{BaseUI => BaseUIPublic}/FontSettings.swift (100%) rename Core/{BaseUI => BaseUIPublic}/FontSpecifying.swift (97%) rename Core/{BaseUI => BaseUIPublic}/ImageExtensions.swift (98%) rename Core/{BaseUI => BaseUIPublic}/Label.swift (99%) rename Core/{BaseUI => BaseUIPublic}/NSAttributedStringExtensions.swift (99%) rename Core/{BaseUI => BaseUIPublic}/PublicInterfaces.swift (96%) rename Core/{BaseUI => BaseUIPublic}/SideInsets.swift (100%) rename Core/{BaseUI => BaseUIPublic}/StringExtensions.swift (95%) rename Core/{BaseUI => BaseUIPublic}/Typo.swift (99%) rename Core/{BaseUI => BaseUIPublic}/UIDeviceExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/UIImageExtensions.swift (97%) rename Core/{BaseUI => BaseUIPublic}/UIImageViewExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/UIMenuControllerExtensions.swift (100%) rename Core/{BaseUI => BaseUIPublic}/UserInterfaceStyle.swift (100%) rename Core/{CommonCore => CommonCorePublic}/CacheRecord.swift (100%) rename Core/{CommonCore => CommonCorePublic}/CacheStorage.swift (100%) rename Core/{CommonCore => CommonCorePublic}/CompletionAccumulating.swift (100%) rename Core/{CommonCore => CommonCorePublic}/CompletionAccumulator.swift (100%) rename Core/{CommonCore => CommonCorePublic}/CompoundScrollDelegate.swift (100%) rename Core/{CommonCore => CommonCorePublic}/ExclusiveTouchCollectionView.swift (100%) rename Core/{CommonCore => CommonCorePublic}/Exported.swift (64%) rename Core/{CommonCore => CommonCorePublic}/HTMLEntities.swift (100%) rename Core/{CommonCore => CommonCorePublic}/HTMLEntitiesResolver.swift (100%) rename Core/{CommonCore => CommonCorePublic}/HTMLParser.swift (98%) rename Core/{CommonCore => CommonCorePublic}/HTMLParserDelegate.swift (100%) rename Core/{CommonCore => CommonCorePublic}/HTMLTag.swift (100%) rename Core/{CommonCore => CommonCorePublic}/HTMLTaggedString.swift (96%) rename Core/{CommonCore => CommonCorePublic}/ImageContaining.swift (100%) rename Core/{CommonCore => CommonCorePublic}/ImageLayerLayout.swift (100%) rename Core/{CommonCore => CommonCorePublic}/ImageRedrawingStyle.swift (96%) create mode 100644 Core/CommonCorePublic/ImageViewBackgroundModel.swift rename Core/{CommonCore => CommonCorePublic}/ImageViewProtocol.swift (100%) rename Core/{CommonCore => CommonCorePublic}/LRUCacheStorage.swift (100%) rename Core/{CommonCore => CommonCorePublic}/LRUMemoization.swift (100%) rename Core/{CommonCore => CommonCorePublic}/LinkedListOrderedDictionary.swift (100%) rename Core/{CommonCore => CommonCorePublic}/MetalImageView.swift (99%) rename Core/{CommonCore => CommonCorePublic}/NSAttributedStringExtensions.swift (98%) rename Core/{CommonCore => CommonCorePublic}/ObjectsReusability.swift (100%) rename Core/{CommonCore => CommonCorePublic}/OrderedDictionary.swift (100%) rename Core/{CommonCore => CommonCorePublic}/RemoteImageView.swift (100%) rename Core/{CommonCore => CommonCorePublic}/RemoteImageViewContainer.swift (100%) rename Core/{CommonCore => CommonCorePublic}/RemoteImageViewContentProtocol.swift (100%) rename Core/{CommonCore => CommonCorePublic}/Resetting.swift (100%) rename Core/{CommonCore => CommonCorePublic}/ScrollableContent.swift (100%) rename Core/{CommonCore => CommonCorePublic}/SizedItem.swift (100%) rename Core/{CommonCore => CommonCorePublic}/Theme.swift (97%) rename Core/{CommonCore => CommonCorePublic}/UIStyles.swift (100%) rename Core/{CommonCore => CommonCorePublic}/ViewProtocol.swift (100%) rename Core/{CommonCore => CommonCorePublic}/VisibleBoundsTracking.swift (100%) rename Core/{Networking => NetworkingPublic}/ActiveRequestsTracker.swift (100%) rename Core/{Networking => NetworkingPublic}/AsyncResourceRequester.swift (99%) rename Core/{Networking => NetworkingPublic}/AuthChallengeHandler.swift (100%) rename Core/{Networking => NetworkingPublic}/ChallengeHandling.swift (100%) rename Core/{Networking => NetworkingPublic}/DataExtensions.swift (100%) rename Core/{Networking => NetworkingPublic}/HTTPCode.swift (100%) rename Core/{Networking => NetworkingPublic}/HTTPErrors.swift (100%) rename Core/{Networking => NetworkingPublic}/HTTPHeaders.swift (100%) rename Core/{Networking => NetworkingPublic}/ImageHolderFactory.swift (99%) rename Core/{Networking => NetworkingPublic}/LocalImageProviding.swift (89%) rename Core/{Networking => NetworkingPublic}/NSErrorExtensions.swift (100%) rename Core/{Networking => NetworkingPublic}/NetworkActivityIndicatorController.swift (100%) rename Core/{Networking => NetworkingPublic}/NetworkSessionMetrics.swift (100%) rename Core/{Networking => NetworkingPublic}/NetworkURLResourceRequester.swift (97%) rename Core/{Networking => NetworkingPublic}/RemoteImageHolder.swift (99%) rename Core/{Networking => NetworkingPublic}/Resource.swift (99%) rename Core/{Networking => NetworkingPublic}/TimeTracking.swift (100%) rename Core/{Networking => NetworkingPublic}/URLRequestPerformer.swift (99%) rename Core/{Networking => NetworkingPublic}/URLRequestPerforming.swift (98%) rename Core/{Networking => NetworkingPublic}/URLSessionDelegateImpl.swift (100%) rename Core/{Networking => NetworkingPublic}/URLSessionTaskMetricsExtensions.swift (100%) rename Core/{Networking => NetworkingPublic}/URLTransform.swift (100%) rename Core/{Networking => NetworkingPublic}/iOS.swift (100%) delete mode 100644 DivKit/generated_sources/DivInputMaskTemplate.swift delete mode 100644 DivKit/generated_sources/DivInputMethod.swift delete mode 100644 DivKit/generated_sources/DivInputMethodTemplate.swift delete mode 100644 DivKit/generated_sources/DivKeyboardInput.swift delete mode 100644 DivKit/generated_sources/DivKeyboardInputTemplate.swift delete mode 100644 DivKit/generated_sources/DivSelectionInput.swift delete mode 100644 DivKit/generated_sources/DivSelectionInputTemplate.swift delete mode 100644 TemplatesSupport/ParsingMode.swift diff --git a/Core/Base/Alignment.swift b/Core/BasePublic/Alignment.swift similarity index 98% rename from Core/Base/Alignment.swift rename to Core/BasePublic/Alignment.swift index 62ee357a..1c514092 100644 --- a/Core/Base/Alignment.swift +++ b/Core/BasePublic/Alignment.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic /// Determines postioning of child item inside parent container @frozen diff --git a/Core/Base/AllocatedUnfairLock.swift b/Core/BasePublic/AllocatedUnfairLock.swift similarity index 100% rename from Core/Base/AllocatedUnfairLock.swift rename to Core/BasePublic/AllocatedUnfairLock.swift diff --git a/Core/Base/AnchoredPoint.swift b/Core/BasePublic/AnchoredPoint.swift similarity index 100% rename from Core/Base/AnchoredPoint.swift rename to Core/BasePublic/AnchoredPoint.swift diff --git a/Core/Base/ArrayExtensions.swift b/Core/BasePublic/ArrayExtensions.swift similarity index 93% rename from Core/Base/ArrayExtensions.swift rename to Core/BasePublic/ArrayExtensions.swift index 384a43a7..afc173d5 100644 --- a/Core/Base/ArrayExtensions.swift +++ b/Core/BasePublic/ArrayExtensions.swift @@ -215,6 +215,25 @@ extension Array { return dict } + public func find(_ transform: (Element) -> T?) -> T? { + for item in self { + if let r = transform(item) { + return r + } + } + return nil + } + + public func findAll(_ transform: (Element) -> T?) -> [T] { + var result = [T]() + forEach { + if let found = transform($0) { + result += found + } + } + return result + } + @inlinable public var randomElement: Element? { guard !isEmpty else { return nil } diff --git a/Core/Base/AutodisposePool.swift b/Core/BasePublic/AutodisposePool.swift similarity index 100% rename from Core/Base/AutodisposePool.swift rename to Core/BasePublic/AutodisposePool.swift diff --git a/Core/Base/BaseExports.swift b/Core/BasePublic/BaseExports.swift similarity index 61% rename from Core/Base/BaseExports.swift rename to Core/BasePublic/BaseExports.swift index 996528e0..11595643 100644 --- a/Core/Base/BaseExports.swift +++ b/Core/BasePublic/BaseExports.swift @@ -1,3 +1,3 @@ // Copyright 2022 Yandex LLC. All rights reserved. -@_exported import BaseTiny +@_exported import BaseTinyPublic diff --git a/Core/Base/CALayerExtensions.swift b/Core/BasePublic/CALayerExtensions.swift similarity index 100% rename from Core/Base/CALayerExtensions.swift rename to Core/BasePublic/CALayerExtensions.swift diff --git a/Core/Base/CAMediaTimingFunction.swift b/Core/BasePublic/CAMediaTimingFunction.swift similarity index 100% rename from Core/Base/CAMediaTimingFunction.swift rename to Core/BasePublic/CAMediaTimingFunction.swift diff --git a/Core/Base/CATransaction+Extensions.swift b/Core/BasePublic/CATransaction+Extensions.swift similarity index 100% rename from Core/Base/CATransaction+Extensions.swift rename to Core/BasePublic/CATransaction+Extensions.swift diff --git a/Core/Base/CGColorExtensions.swift b/Core/BasePublic/CGColorExtensions.swift similarity index 100% rename from Core/Base/CGColorExtensions.swift rename to Core/BasePublic/CGColorExtensions.swift diff --git a/Core/Base/CGFloatExtensions.swift b/Core/BasePublic/CGFloatExtensions.swift similarity index 100% rename from Core/Base/CGFloatExtensions.swift rename to Core/BasePublic/CGFloatExtensions.swift diff --git a/Core/Base/CGPointExtensions.swift b/Core/BasePublic/CGPointExtensions.swift similarity index 100% rename from Core/Base/CGPointExtensions.swift rename to Core/BasePublic/CGPointExtensions.swift diff --git a/Core/Base/CGRectExtensions.swift b/Core/BasePublic/CGRectExtensions.swift similarity index 100% rename from Core/Base/CGRectExtensions.swift rename to Core/BasePublic/CGRectExtensions.swift diff --git a/Core/Base/CGSizeExtensions.swift b/Core/BasePublic/CGSizeExtensions.swift similarity index 100% rename from Core/Base/CGSizeExtensions.swift rename to Core/BasePublic/CGSizeExtensions.swift diff --git a/Core/Base/Cancellable.swift b/Core/BasePublic/Cancellable.swift similarity index 100% rename from Core/Base/Cancellable.swift rename to Core/BasePublic/Cancellable.swift diff --git a/Core/Base/ColorExtensions.swift b/Core/BasePublic/ColorExtensions.swift similarity index 100% rename from Core/Base/ColorExtensions.swift rename to Core/BasePublic/ColorExtensions.swift diff --git a/Core/Base/ColorHolder.swift b/Core/BasePublic/ColorHolder.swift similarity index 100% rename from Core/Base/ColorHolder.swift rename to Core/BasePublic/ColorHolder.swift diff --git a/Core/Base/Combine.swift b/Core/BasePublic/Combine.swift similarity index 100% rename from Core/Base/Combine.swift rename to Core/BasePublic/Combine.swift diff --git a/Core/Base/ComparableExtension.swift b/Core/BasePublic/ComparableExtension.swift similarity index 100% rename from Core/Base/ComparableExtension.swift rename to Core/BasePublic/ComparableExtension.swift diff --git a/Core/Base/DeferredValue.swift b/Core/BasePublic/DeferredValue.swift similarity index 100% rename from Core/Base/DeferredValue.swift rename to Core/BasePublic/DeferredValue.swift diff --git a/Core/Base/DictionaryExtensions.swift b/Core/BasePublic/DictionaryExtensions.swift similarity index 100% rename from Core/Base/DictionaryExtensions.swift rename to Core/BasePublic/DictionaryExtensions.swift diff --git a/Core/Base/DimensionsFlipping.swift b/Core/BasePublic/DimensionsFlipping.swift similarity index 100% rename from Core/Base/DimensionsFlipping.swift rename to Core/BasePublic/DimensionsFlipping.swift diff --git a/Core/Base/Disposable.swift b/Core/BasePublic/Disposable.swift similarity index 100% rename from Core/Base/Disposable.swift rename to Core/BasePublic/Disposable.swift diff --git a/Core/Base/EdgeInsets+Extensions.swift b/Core/BasePublic/EdgeInsets+Extensions.swift similarity index 98% rename from Core/Base/EdgeInsets+Extensions.swift rename to Core/BasePublic/EdgeInsets+Extensions.swift index 93415687..055628ba 100644 --- a/Core/Base/EdgeInsets+Extensions.swift +++ b/Core/BasePublic/EdgeInsets+Extensions.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic extension EdgeInsets: YCEdgeInsets { public typealias Domain = CGFloat diff --git a/Core/Base/EdgeInsetsExtensions.swift b/Core/BasePublic/EdgeInsetsExtensions.swift similarity index 98% rename from Core/Base/EdgeInsetsExtensions.swift rename to Core/BasePublic/EdgeInsetsExtensions.swift index 57f7da25..b22b48b1 100644 --- a/Core/Base/EdgeInsetsExtensions.swift +++ b/Core/BasePublic/EdgeInsetsExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseUI +import BaseUIPublic extension EdgeInsets { public func insetHeight(_ height: CGFloat) -> CGFloat { diff --git a/Core/Base/Either.swift b/Core/BasePublic/Either.swift similarity index 100% rename from Core/Base/Either.swift rename to Core/BasePublic/Either.swift diff --git a/Core/Base/EncodableExtensions.swift b/Core/BasePublic/EncodableExtensions.swift similarity index 100% rename from Core/Base/EncodableExtensions.swift rename to Core/BasePublic/EncodableExtensions.swift diff --git a/Core/Base/FilterProtocol.swift b/Core/BasePublic/FilterProtocol.swift similarity index 100% rename from Core/Base/FilterProtocol.swift rename to Core/BasePublic/FilterProtocol.swift diff --git a/Core/Base/Functions.swift b/Core/BasePublic/Functions.swift similarity index 100% rename from Core/Base/Functions.swift rename to Core/BasePublic/Functions.swift diff --git a/Core/Base/Future.swift b/Core/BasePublic/Future.swift similarity index 100% rename from Core/Base/Future.swift rename to Core/BasePublic/Future.swift diff --git a/Core/Base/GCD.swift b/Core/BasePublic/GCD.swift similarity index 100% rename from Core/Base/GCD.swift rename to Core/BasePublic/GCD.swift diff --git a/Core/Base/Gradient.swift b/Core/BasePublic/Gradient.swift similarity index 99% rename from Core/Base/Gradient.swift rename to Core/BasePublic/Gradient.swift index 6471d206..e3fcf512 100644 --- a/Core/Base/Gradient.swift +++ b/Core/BasePublic/Gradient.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic @frozen public enum Gradient: Equatable { diff --git a/Core/Base/HTTPURLResponse+Extensions.swift b/Core/BasePublic/HTTPURLResponse+Extensions.swift similarity index 100% rename from Core/Base/HTTPURLResponse+Extensions.swift rename to Core/BasePublic/HTTPURLResponse+Extensions.swift diff --git a/Core/Base/Image+Crop.swift b/Core/BasePublic/Image+Crop.swift similarity index 100% rename from Core/Base/Image+Crop.swift rename to Core/BasePublic/Image+Crop.swift diff --git a/Core/Base/ImageBlur.swift b/Core/BasePublic/ImageBlur.swift similarity index 100% rename from Core/Base/ImageBlur.swift rename to Core/BasePublic/ImageBlur.swift diff --git a/Core/Base/ImageComposer.swift b/Core/BasePublic/ImageComposer.swift similarity index 100% rename from Core/Base/ImageComposer.swift rename to Core/BasePublic/ImageComposer.swift diff --git a/Core/Base/ImageContentMode.swift b/Core/BasePublic/ImageContentMode.swift similarity index 100% rename from Core/Base/ImageContentMode.swift rename to Core/BasePublic/ImageContentMode.swift diff --git a/Core/Base/ImageCrop.swift b/Core/BasePublic/ImageCrop.swift similarity index 100% rename from Core/Base/ImageCrop.swift rename to Core/BasePublic/ImageCrop.swift diff --git a/Core/Base/ImageEffect.swift b/Core/BasePublic/ImageEffect.swift similarity index 100% rename from Core/Base/ImageEffect.swift rename to Core/BasePublic/ImageEffect.swift diff --git a/Core/Base/ImageExtensions.swift b/Core/BasePublic/ImageExtensions.swift similarity index 100% rename from Core/Base/ImageExtensions.swift rename to Core/BasePublic/ImageExtensions.swift diff --git a/Core/Base/ImageFilters.swift b/Core/BasePublic/ImageFilters.swift similarity index 100% rename from Core/Base/ImageFilters.swift rename to Core/BasePublic/ImageFilters.swift diff --git a/Core/Base/ImageGenerator.swift b/Core/BasePublic/ImageGenerator.swift similarity index 100% rename from Core/Base/ImageGenerator.swift rename to Core/BasePublic/ImageGenerator.swift diff --git a/Core/Base/ImageHolder.swift b/Core/BasePublic/ImageHolder.swift similarity index 100% rename from Core/Base/ImageHolder.swift rename to Core/BasePublic/ImageHolder.swift diff --git a/Core/Base/ImagePlaceholder.swift b/Core/BasePublic/ImagePlaceholder.swift similarity index 98% rename from Core/Base/ImagePlaceholder.swift rename to Core/BasePublic/ImagePlaceholder.swift index ad809cae..baead47f 100644 --- a/Core/Base/ImagePlaceholder.swift +++ b/Core/BasePublic/ImagePlaceholder.swift @@ -1,6 +1,6 @@ // Copyright 2019 Yandex LLC. All rights reserved. -import BaseUI +import BaseUIPublic public enum ImagePlaceholder: Equatable, CustomDebugStringConvertible { case image(Image) diff --git a/Core/Base/IndexSetExtensions.swift b/Core/BasePublic/IndexSetExtensions.swift similarity index 100% rename from Core/Base/IndexSetExtensions.swift rename to Core/BasePublic/IndexSetExtensions.swift diff --git a/Core/Base/InternalImageDescriptor.swift b/Core/BasePublic/InternalImageDescriptor.swift similarity index 100% rename from Core/Base/InternalImageDescriptor.swift rename to Core/BasePublic/InternalImageDescriptor.swift diff --git a/Core/Base/InvalidArgumentError.swift b/Core/BasePublic/InvalidArgumentError.swift similarity index 100% rename from Core/Base/InvalidArgumentError.swift rename to Core/BasePublic/InvalidArgumentError.swift diff --git a/Core/Base/KeyValueDirectStoringSupporting.swift b/Core/BasePublic/KeyValueDirectStoringSupporting.swift similarity index 100% rename from Core/Base/KeyValueDirectStoringSupporting.swift rename to Core/BasePublic/KeyValueDirectStoringSupporting.swift diff --git a/Core/Base/KeyValueStorage.swift b/Core/BasePublic/KeyValueStorage.swift similarity index 100% rename from Core/Base/KeyValueStorage.swift rename to Core/BasePublic/KeyValueStorage.swift diff --git a/Core/Base/KeyboardAppearance.swift b/Core/BasePublic/KeyboardAppearance.swift similarity index 100% rename from Core/Base/KeyboardAppearance.swift rename to Core/BasePublic/KeyboardAppearance.swift diff --git a/Core/Base/Lazy.swift b/Core/BasePublic/Lazy.swift similarity index 100% rename from Core/Base/Lazy.swift rename to Core/BasePublic/Lazy.swift diff --git a/Core/Base/LinearGradientView+Layer.swift b/Core/BasePublic/LinearGradientView+Layer.swift similarity index 100% rename from Core/Base/LinearGradientView+Layer.swift rename to Core/BasePublic/LinearGradientView+Layer.swift diff --git a/Core/Base/NSTimerExtensions.swift b/Core/BasePublic/NSTimerExtensions.swift similarity index 99% rename from Core/Base/NSTimerExtensions.swift rename to Core/BasePublic/NSTimerExtensions.swift index 4f7cd036..5e44d517 100644 --- a/Core/Base/NSTimerExtensions.swift +++ b/Core/BasePublic/NSTimerExtensions.swift @@ -76,7 +76,6 @@ public final class TimerScheduler: Scheduling { extension Timer: TimerType {} extension Timer { - @_spi(Base) public static func make( withTimeInterval ti: TimeInterval, handler: @escaping () -> Void, diff --git a/Core/Base/NSURLExtensions.swift b/Core/BasePublic/NSURLExtensions.swift similarity index 100% rename from Core/Base/NSURLExtensions.swift rename to Core/BasePublic/NSURLExtensions.swift diff --git a/Core/Base/NilImageHolder.swift b/Core/BasePublic/NilImageHolder.swift similarity index 100% rename from Core/Base/NilImageHolder.swift rename to Core/BasePublic/NilImageHolder.swift diff --git a/Core/Base/NonEmpty+Array.swift b/Core/BasePublic/NonEmpty+Array.swift similarity index 100% rename from Core/Base/NonEmpty+Array.swift rename to Core/BasePublic/NonEmpty+Array.swift diff --git a/Core/Base/NonEmpty+Set.swift b/Core/BasePublic/NonEmpty+Set.swift similarity index 100% rename from Core/Base/NonEmpty+Set.swift rename to Core/BasePublic/NonEmpty+Set.swift diff --git a/Core/Base/NonEmpty+String.swift b/Core/BasePublic/NonEmpty+String.swift similarity index 100% rename from Core/Base/NonEmpty+String.swift rename to Core/BasePublic/NonEmpty+String.swift diff --git a/Core/Base/NonEmpty.swift b/Core/BasePublic/NonEmpty.swift similarity index 100% rename from Core/Base/NonEmpty.swift rename to Core/BasePublic/NonEmpty.swift diff --git a/Core/Base/ObservableProperty.swift b/Core/BasePublic/ObservableProperty.swift similarity index 100% rename from Core/Base/ObservableProperty.swift rename to Core/BasePublic/ObservableProperty.swift diff --git a/Core/Base/ObservableVariable.swift b/Core/BasePublic/ObservableVariable.swift similarity index 100% rename from Core/Base/ObservableVariable.swift rename to Core/BasePublic/ObservableVariable.swift diff --git a/Core/Base/Observer.swift b/Core/BasePublic/Observer.swift similarity index 100% rename from Core/Base/Observer.swift rename to Core/BasePublic/Observer.swift diff --git a/Core/Base/OperationQueue.swift b/Core/BasePublic/OperationQueue.swift similarity index 100% rename from Core/Base/OperationQueue.swift rename to Core/BasePublic/OperationQueue.swift diff --git a/Core/Base/OptionalExtensions.swift b/Core/BasePublic/OptionalExtensions.swift similarity index 100% rename from Core/Base/OptionalExtensions.swift rename to Core/BasePublic/OptionalExtensions.swift diff --git a/Core/Base/PhysicalFeedbackGenerator.swift b/Core/BasePublic/PhysicalFeedbackGenerator.swift similarity index 100% rename from Core/Base/PhysicalFeedbackGenerator.swift rename to Core/BasePublic/PhysicalFeedbackGenerator.swift diff --git a/Core/Base/Promise.swift b/Core/BasePublic/Promise.swift similarity index 100% rename from Core/Base/Promise.swift rename to Core/BasePublic/Promise.swift diff --git a/Core/Base/Property.swift b/Core/BasePublic/Property.swift similarity index 100% rename from Core/Base/Property.swift rename to Core/BasePublic/Property.swift diff --git a/Core/Base/RGBAColorExtensions.swift b/Core/BasePublic/RGBAColorExtensions.swift similarity index 100% rename from Core/Base/RGBAColorExtensions.swift rename to Core/BasePublic/RGBAColorExtensions.swift diff --git a/Core/Base/RadialGradientView.swift b/Core/BasePublic/RadialGradientView.swift similarity index 100% rename from Core/Base/RadialGradientView.swift rename to Core/BasePublic/RadialGradientView.swift diff --git a/Core/Base/Range+Extensions.swift b/Core/BasePublic/Range+Extensions.swift similarity index 100% rename from Core/Base/Range+Extensions.swift rename to Core/BasePublic/Range+Extensions.swift diff --git a/Core/Base/RangeReplaceableCollectionExtensions.swift b/Core/BasePublic/RangeReplaceableCollectionExtensions.swift similarity index 100% rename from Core/Base/RangeReplaceableCollectionExtensions.swift rename to Core/BasePublic/RangeReplaceableCollectionExtensions.swift diff --git a/Core/Base/RelativePoint.swift b/Core/BasePublic/RelativePoint.swift similarity index 99% rename from Core/Base/RelativePoint.swift rename to Core/BasePublic/RelativePoint.swift index fb5e7e97..4ce5399c 100644 --- a/Core/Base/RelativePoint.swift +++ b/Core/BasePublic/RelativePoint.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic public struct RelativePoint: Equatable { public var rawValue: CGPoint diff --git a/Core/Base/RelativeRect.swift b/Core/BasePublic/RelativeRect.swift similarity index 99% rename from Core/Base/RelativeRect.swift rename to Core/BasePublic/RelativeRect.swift index b3e5455a..3ddccdc6 100644 --- a/Core/Base/RelativeRect.swift +++ b/Core/BasePublic/RelativeRect.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic public struct RelativeRect: Hashable { public var origin: RelativePoint diff --git a/Core/Base/RelativeSize.swift b/Core/BasePublic/RelativeSize.swift similarity index 100% rename from Core/Base/RelativeSize.swift rename to Core/BasePublic/RelativeSize.swift diff --git a/Core/Base/RelativeValue.swift b/Core/BasePublic/RelativeValue.swift similarity index 100% rename from Core/Base/RelativeValue.swift rename to Core/BasePublic/RelativeValue.swift diff --git a/Core/Base/Result.swift b/Core/BasePublic/Result.swift similarity index 100% rename from Core/Base/Result.swift rename to Core/BasePublic/Result.swift diff --git a/Core/Base/ScrollDelegate.swift b/Core/BasePublic/ScrollDelegate.swift similarity index 100% rename from Core/Base/ScrollDelegate.swift rename to Core/BasePublic/ScrollDelegate.swift diff --git a/Core/Base/ScrollEdge.swift b/Core/BasePublic/ScrollEdge.swift similarity index 100% rename from Core/Base/ScrollEdge.swift rename to Core/BasePublic/ScrollEdge.swift diff --git a/Core/Base/ScrollViewTrackable.swift b/Core/BasePublic/ScrollViewTrackable.swift similarity index 100% rename from Core/Base/ScrollViewTrackable.swift rename to Core/BasePublic/ScrollViewTrackable.swift diff --git a/Core/Base/ScrollViewType.swift b/Core/BasePublic/ScrollViewType.swift similarity index 99% rename from Core/Base/ScrollViewType.swift rename to Core/BasePublic/ScrollViewType.swift index dca7db06..3cd1713a 100644 --- a/Core/Base/ScrollViewType.swift +++ b/Core/BasePublic/ScrollViewType.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseUI +import BaseUIPublic #if os(iOS) import UIKit.UIScrollView diff --git a/Core/Base/ScrollingToTop.swift b/Core/BasePublic/ScrollingToTop.swift similarity index 100% rename from Core/Base/ScrollingToTop.swift rename to Core/BasePublic/ScrollingToTop.swift diff --git a/Core/Base/SequenceExtensions.swift b/Core/BasePublic/SequenceExtensions.swift similarity index 100% rename from Core/Base/SequenceExtensions.swift rename to Core/BasePublic/SequenceExtensions.swift diff --git a/Core/Base/SettingProperty.swift b/Core/BasePublic/SettingProperty.swift similarity index 100% rename from Core/Base/SettingProperty.swift rename to Core/BasePublic/SettingProperty.swift diff --git a/Core/Base/Signal+CombineLatest.swift b/Core/BasePublic/Signal+CombineLatest.swift similarity index 100% rename from Core/Base/Signal+CombineLatest.swift rename to Core/BasePublic/Signal+CombineLatest.swift diff --git a/Core/Base/Signal.swift b/Core/BasePublic/Signal.swift similarity index 100% rename from Core/Base/Signal.swift rename to Core/BasePublic/Signal.swift diff --git a/Core/Base/SignalPipe.swift b/Core/BasePublic/SignalPipe.swift similarity index 100% rename from Core/Base/SignalPipe.swift rename to Core/BasePublic/SignalPipe.swift diff --git a/Core/Base/SingleValueCoder.swift b/Core/BasePublic/SingleValueCoder.swift similarity index 100% rename from Core/Base/SingleValueCoder.swift rename to Core/BasePublic/SingleValueCoder.swift diff --git a/Core/Base/StatusBarStyle.swift b/Core/BasePublic/StatusBarStyle.swift similarity index 100% rename from Core/Base/StatusBarStyle.swift rename to Core/BasePublic/StatusBarStyle.swift diff --git a/Core/Base/String+Extensions.swift b/Core/BasePublic/String+Extensions.swift similarity index 98% rename from Core/Base/String+Extensions.swift rename to Core/BasePublic/String+Extensions.swift index 3c29bd10..d3d74f9a 100644 --- a/Core/Base/String+Extensions.swift +++ b/Core/BasePublic/String+Extensions.swift @@ -2,7 +2,7 @@ import Foundation -import BaseUI +import BaseUIPublic extension String { public enum PaddingSide { @@ -40,7 +40,7 @@ extension String { enumerateSubstrings( in: wholeStringRange, options: .byWords - ) { _, _wordRange, _enclosingRange, stop in + ) { _, _wordRange, _enclosingRange, stop -> Void in let caretAtTheBeginningOfWord = _wordRange.lowerBound == caretPos let caretInsideWord = _wordRange.contains(caretPos) let caretAtTheEndOfWord = _wordRange.upperBound == caretPos @@ -60,7 +60,7 @@ extension String { public func allWordRanges() -> [Range] { var wordRanges: [Range] = [] - enumerateSubstrings(in: wholeStringRange, options: .byWords) { _, range, _, _ in + enumerateSubstrings(in: wholeStringRange, options: .byWords) { _, range, _, _ -> Void in wordRanges.append(range) } return wordRanges diff --git a/Core/Base/ThreadExtensions.swift b/Core/BasePublic/ThreadExtensions.swift similarity index 100% rename from Core/Base/ThreadExtensions.swift rename to Core/BasePublic/ThreadExtensions.swift diff --git a/Core/Base/Time.swift b/Core/BasePublic/Time.swift similarity index 100% rename from Core/Base/Time.swift rename to Core/BasePublic/Time.swift diff --git a/Core/Base/TintMode.swift b/Core/BasePublic/TintMode.swift similarity index 100% rename from Core/Base/TintMode.swift rename to Core/BasePublic/TintMode.swift diff --git a/Core/Base/TupleExtensions.swift b/Core/BasePublic/TupleExtensions.swift similarity index 100% rename from Core/Base/TupleExtensions.swift rename to Core/BasePublic/TupleExtensions.swift diff --git a/Core/Base/UIScrollView+Extensions.swift b/Core/BasePublic/UIScrollView+Extensions.swift similarity index 100% rename from Core/Base/UIScrollView+Extensions.swift rename to Core/BasePublic/UIScrollView+Extensions.swift diff --git a/Core/Base/UIViewExtensions.swift b/Core/BasePublic/UIViewExtensions.swift similarity index 100% rename from Core/Base/UIViewExtensions.swift rename to Core/BasePublic/UIViewExtensions.swift diff --git a/Core/Base/URLResourceRequesting.swift b/Core/BasePublic/URLResourceRequesting.swift similarity index 100% rename from Core/Base/URLResourceRequesting.swift rename to Core/BasePublic/URLResourceRequesting.swift diff --git a/Core/Base/UnsignedIntegerExtenstions.swift b/Core/BasePublic/UnsignedIntegerExtenstions.swift similarity index 100% rename from Core/Base/UnsignedIntegerExtenstions.swift rename to Core/BasePublic/UnsignedIntegerExtenstions.swift diff --git a/Core/Base/UrlOpener.swift b/Core/BasePublic/UrlOpener.swift similarity index 100% rename from Core/Base/UrlOpener.swift rename to Core/BasePublic/UrlOpener.swift diff --git a/Core/Base/Variable.swift b/Core/BasePublic/Variable.swift similarity index 100% rename from Core/Base/Variable.swift rename to Core/BasePublic/Variable.swift diff --git a/Core/Base/ViewImageHolder.swift b/Core/BasePublic/ViewImageHolder.swift similarity index 100% rename from Core/Base/ViewImageHolder.swift rename to Core/BasePublic/ViewImageHolder.swift diff --git a/Core/Base/WeakCollection.swift b/Core/BasePublic/WeakCollection.swift similarity index 90% rename from Core/Base/WeakCollection.swift rename to Core/BasePublic/WeakCollection.swift index 2cb193f9..6798f603 100644 --- a/Core/Base/WeakCollection.swift +++ b/Core/BasePublic/WeakCollection.swift @@ -17,10 +17,18 @@ public struct WeakCollection { public mutating func append(_ object: T) { assert((object as AnyObject) is T) - array = array.filter { $0.value != nil } + compact() array.append(Weak(value: object as AnyObject)) } + public mutating func append(_ objects: [T]) { + compact() + for object in objects { + assert((object as AnyObject) is T) + array.append(Weak(value: object as AnyObject)) + } + } + public mutating func remove(_ object: T) { guard let objectIndex = array.firstIndex(where: { $0.value === (object as AnyObject) }) else { return } @@ -46,6 +54,10 @@ public struct WeakCollection { public mutating func removeAll() { array.removeAll() } + + public mutating func compact() { + array = array.filter { $0.value != nil } + } } extension WeakCollection: CustomStringConvertible { diff --git a/Core/Base/iOS.swift b/Core/BasePublic/iOS.swift similarity index 100% rename from Core/Base/iOS.swift rename to Core/BasePublic/iOS.swift diff --git a/Core/Base/weakify.swift b/Core/BasePublic/weakify.swift similarity index 100% rename from Core/Base/weakify.swift rename to Core/BasePublic/weakify.swift diff --git a/Core/BaseTiny/Action.swift b/Core/BaseTinyPublic/Action.swift similarity index 100% rename from Core/BaseTiny/Action.swift rename to Core/BaseTinyPublic/Action.swift diff --git a/Core/BaseTiny/ArrayBuilder.swift b/Core/BaseTinyPublic/ArrayBuilder.swift similarity index 100% rename from Core/BaseTiny/ArrayBuilder.swift rename to Core/BaseTinyPublic/ArrayBuilder.swift diff --git a/Core/BaseTiny/Atomic.swift b/Core/BaseTinyPublic/Atomic.swift similarity index 100% rename from Core/BaseTiny/Atomic.swift rename to Core/BaseTinyPublic/Atomic.swift diff --git a/Core/BaseTiny/CFCasting.swift b/Core/BaseTinyPublic/CFCasting.swift similarity index 100% rename from Core/BaseTiny/CFCasting.swift rename to Core/BaseTinyPublic/CFCasting.swift diff --git a/Core/BaseTiny/Clamp.swift b/Core/BaseTinyPublic/Clamp.swift similarity index 100% rename from Core/BaseTiny/Clamp.swift rename to Core/BaseTinyPublic/Clamp.swift diff --git a/Core/BaseTiny/CollectionExtensions.swift b/Core/BaseTinyPublic/CollectionExtensions.swift similarity index 100% rename from Core/BaseTiny/CollectionExtensions.swift rename to Core/BaseTinyPublic/CollectionExtensions.swift diff --git a/Core/BaseTiny/ColorExtensions.swift b/Core/BaseTinyPublic/ColorExtensions.swift similarity index 100% rename from Core/BaseTiny/ColorExtensions.swift rename to Core/BaseTinyPublic/ColorExtensions.swift diff --git a/Core/BaseTiny/DictionaryExtensions.swift b/Core/BaseTinyPublic/DictionaryExtensions.swift similarity index 100% rename from Core/BaseTiny/DictionaryExtensions.swift rename to Core/BaseTinyPublic/DictionaryExtensions.swift diff --git a/Core/BaseTiny/FloatingPointComparison.swift b/Core/BaseTinyPublic/FloatingPointComparison.swift similarity index 100% rename from Core/BaseTiny/FloatingPointComparison.swift rename to Core/BaseTinyPublic/FloatingPointComparison.swift diff --git a/Core/BaseTiny/JSONObject.swift b/Core/BaseTinyPublic/JSONObject.swift similarity index 100% rename from Core/BaseTiny/JSONObject.swift rename to Core/BaseTinyPublic/JSONObject.swift diff --git a/Core/BaseTiny/Memoization.swift b/Core/BaseTinyPublic/Memoization.swift similarity index 100% rename from Core/BaseTiny/Memoization.swift rename to Core/BaseTinyPublic/Memoization.swift diff --git a/Core/BaseTiny/Modifier.swift b/Core/BaseTinyPublic/Modifier.swift similarity index 100% rename from Core/BaseTiny/Modifier.swift rename to Core/BaseTinyPublic/Modifier.swift diff --git a/Core/BaseTiny/NSKeyedArchiver+Legacy.swift b/Core/BaseTinyPublic/NSKeyedArchiver+Legacy.swift similarity index 100% rename from Core/BaseTiny/NSKeyedArchiver+Legacy.swift rename to Core/BaseTinyPublic/NSKeyedArchiver+Legacy.swift diff --git a/Core/BaseTiny/NSKeyedUnarchiver+Legacy.swift b/Core/BaseTinyPublic/NSKeyedUnarchiver+Legacy.swift similarity index 100% rename from Core/BaseTiny/NSKeyedUnarchiver+Legacy.swift rename to Core/BaseTinyPublic/NSKeyedUnarchiver+Legacy.swift diff --git a/Core/BaseTiny/OAuthToken.swift b/Core/BaseTinyPublic/OAuthToken.swift similarity index 100% rename from Core/BaseTiny/OAuthToken.swift rename to Core/BaseTinyPublic/OAuthToken.swift diff --git a/Core/BaseTiny/PersistentStorage.swift b/Core/BaseTinyPublic/PersistentStorage.swift similarity index 100% rename from Core/BaseTiny/PersistentStorage.swift rename to Core/BaseTinyPublic/PersistentStorage.swift diff --git a/Core/BaseTiny/RGBAColor.swift b/Core/BaseTinyPublic/RGBAColor.swift similarity index 100% rename from Core/BaseTiny/RGBAColor.swift rename to Core/BaseTinyPublic/RGBAColor.swift diff --git a/Core/BaseTiny/RWLock.swift b/Core/BaseTinyPublic/RWLock.swift similarity index 100% rename from Core/BaseTiny/RWLock.swift rename to Core/BaseTinyPublic/RWLock.swift diff --git a/Core/BaseTiny/Radix.swift b/Core/BaseTinyPublic/Radix.swift similarity index 100% rename from Core/BaseTiny/Radix.swift rename to Core/BaseTinyPublic/Radix.swift diff --git a/Core/BaseTiny/Result.swift b/Core/BaseTinyPublic/Result.swift similarity index 100% rename from Core/BaseTiny/Result.swift rename to Core/BaseTinyPublic/Result.swift diff --git a/Core/BaseTiny/SequenceExtensions.swift b/Core/BaseTinyPublic/SequenceExtensions.swift similarity index 100% rename from Core/BaseTiny/SequenceExtensions.swift rename to Core/BaseTinyPublic/SequenceExtensions.swift diff --git a/Core/BaseTiny/StringExtensions.swift b/Core/BaseTinyPublic/StringExtensions.swift similarity index 100% rename from Core/BaseTiny/StringExtensions.swift rename to Core/BaseTinyPublic/StringExtensions.swift diff --git a/Core/BaseTiny/Tagged.swift b/Core/BaseTinyPublic/Tagged.swift similarity index 100% rename from Core/BaseTiny/Tagged.swift rename to Core/BaseTinyPublic/Tagged.swift diff --git a/Core/BaseTiny/URLExtensions.swift b/Core/BaseTinyPublic/URLExtensions.swift similarity index 100% rename from Core/BaseTiny/URLExtensions.swift rename to Core/BaseTinyPublic/URLExtensions.swift diff --git a/Core/BaseTiny/iOS.swift b/Core/BaseTinyPublic/iOS.swift similarity index 100% rename from Core/BaseTiny/iOS.swift rename to Core/BaseTinyPublic/iOS.swift diff --git a/Core/BaseUI/AccessibilityElement.swift b/Core/BaseUIPublic/AccessibilityElement.swift similarity index 100% rename from Core/BaseUI/AccessibilityElement.swift rename to Core/BaseUIPublic/AccessibilityElement.swift diff --git a/Core/BaseUI/AccessibilityElementExtensions.swift b/Core/BaseUIPublic/AccessibilityElementExtensions.swift similarity index 100% rename from Core/BaseUI/AccessibilityElementExtensions.swift rename to Core/BaseUIPublic/AccessibilityElementExtensions.swift diff --git a/Core/BaseUI/AccessibilityPriorities.swift b/Core/BaseUIPublic/AccessibilityPriorities.swift similarity index 100% rename from Core/BaseUI/AccessibilityPriorities.swift rename to Core/BaseUIPublic/AccessibilityPriorities.swift diff --git a/Core/BaseUI/ActionSheetModel.swift b/Core/BaseUIPublic/ActionSheetModel.swift similarity index 100% rename from Core/BaseUI/ActionSheetModel.swift rename to Core/BaseUIPublic/ActionSheetModel.swift diff --git a/Core/BaseUI/ActionSheetUI.swift b/Core/BaseUIPublic/ActionSheetUI.swift similarity index 100% rename from Core/BaseUI/ActionSheetUI.swift rename to Core/BaseUIPublic/ActionSheetUI.swift diff --git a/Core/BaseUI/AlertButton.swift b/Core/BaseUIPublic/AlertButton.swift similarity index 100% rename from Core/BaseUI/AlertButton.swift rename to Core/BaseUIPublic/AlertButton.swift diff --git a/Core/BaseUI/AlertModel.swift b/Core/BaseUIPublic/AlertModel.swift similarity index 100% rename from Core/BaseUI/AlertModel.swift rename to Core/BaseUIPublic/AlertModel.swift diff --git a/Core/BaseUI/AlertTextField.swift b/Core/BaseUIPublic/AlertTextField.swift similarity index 100% rename from Core/BaseUI/AlertTextField.swift rename to Core/BaseUIPublic/AlertTextField.swift diff --git a/Core/BaseUI/AlertUI.swift b/Core/BaseUIPublic/AlertUI.swift similarity index 100% rename from Core/BaseUI/AlertUI.swift rename to Core/BaseUIPublic/AlertUI.swift diff --git a/Core/BaseUI/AttributedStringLayout.swift b/Core/BaseUIPublic/AttributedStringLayout.swift similarity index 100% rename from Core/BaseUI/AttributedStringLayout.swift rename to Core/BaseUIPublic/AttributedStringLayout.swift diff --git a/Core/BaseUI/BackgroundAttribute.swift b/Core/BaseUIPublic/BackgroundAttribute.swift similarity index 100% rename from Core/BaseUI/BackgroundAttribute.swift rename to Core/BaseUIPublic/BackgroundAttribute.swift diff --git a/Core/BaseUI/BezierCurve.swift b/Core/BaseUIPublic/BezierCurve.swift similarity index 100% rename from Core/BaseUI/BezierCurve.swift rename to Core/BaseUIPublic/BezierCurve.swift diff --git a/Core/BaseUI/BorderAttribute.swift b/Core/BaseUIPublic/BorderAttribute.swift similarity index 100% rename from Core/BaseUI/BorderAttribute.swift rename to Core/BaseUIPublic/BorderAttribute.swift diff --git a/Core/BaseUI/CAAnimationExtensions.swift b/Core/BaseUIPublic/CAAnimationExtensions.swift similarity index 100% rename from Core/BaseUI/CAAnimationExtensions.swift rename to Core/BaseUIPublic/CAAnimationExtensions.swift diff --git a/Core/BaseUI/CGAffineTransformExtensions.swift b/Core/BaseUIPublic/CGAffineTransformExtensions.swift similarity index 100% rename from Core/BaseUI/CGAffineTransformExtensions.swift rename to Core/BaseUIPublic/CGAffineTransformExtensions.swift diff --git a/Core/BaseUI/CGColorExtensions.swift b/Core/BaseUIPublic/CGColorExtensions.swift similarity index 93% rename from Core/BaseUI/CGColorExtensions.swift rename to Core/BaseUIPublic/CGColorExtensions.swift index 84816837..408d1f74 100644 --- a/Core/BaseUI/CGColorExtensions.swift +++ b/Core/BaseUIPublic/CGColorExtensions.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseTiny +import BaseTinyPublic @_implementationOnly import CoreImage diff --git a/Core/BaseUI/CGContextExtensions.swift b/Core/BaseUIPublic/CGContextExtensions.swift similarity index 90% rename from Core/BaseUI/CGContextExtensions.swift rename to Core/BaseUIPublic/CGContextExtensions.swift index bf3cee7e..beb9b921 100644 --- a/Core/BaseUI/CGContextExtensions.swift +++ b/Core/BaseUIPublic/CGContextExtensions.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseTiny +import BaseTinyPublic extension CGContext { public func inSeparateGState(_ block: Action) { diff --git a/Core/BaseUI/CGFloatExtensions.swift b/Core/BaseUIPublic/CGFloatExtensions.swift similarity index 98% rename from Core/BaseUI/CGFloatExtensions.swift rename to Core/BaseUIPublic/CGFloatExtensions.swift index 69a9ce84..e1cd3f55 100644 --- a/Core/BaseUI/CGFloatExtensions.swift +++ b/Core/BaseUIPublic/CGFloatExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseTiny +import BaseTinyPublic extension CGFloat { public func rounded(toStep step: CGFloat = 1) -> CGFloat { diff --git a/Core/BaseUI/CGPointExtensions.swift b/Core/BaseUIPublic/CGPointExtensions.swift similarity index 100% rename from Core/BaseUI/CGPointExtensions.swift rename to Core/BaseUIPublic/CGPointExtensions.swift diff --git a/Core/BaseUI/CGRectExtensions.swift b/Core/BaseUIPublic/CGRectExtensions.swift similarity index 95% rename from Core/BaseUI/CGRectExtensions.swift rename to Core/BaseUIPublic/CGRectExtensions.swift index d1b2d1e7..17c6abc3 100644 --- a/Core/BaseUI/CGRectExtensions.swift +++ b/Core/BaseUIPublic/CGRectExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseTiny +import BaseTinyPublic extension CGRect { public func inset(by value: CGFloat) -> CGRect { diff --git a/Core/BaseUI/CGSizeExtensions.swift b/Core/BaseUIPublic/CGSizeExtensions.swift similarity index 98% rename from Core/BaseUI/CGSizeExtensions.swift rename to Core/BaseUIPublic/CGSizeExtensions.swift index 8fc56b8b..b8aead73 100644 --- a/Core/BaseUI/CGSizeExtensions.swift +++ b/Core/BaseUIPublic/CGSizeExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseTiny +import BaseTinyPublic extension CGSize: Hashable { public static var infinite: CGSize { diff --git a/Core/BaseUI/EdgeInsetsExtensions.swift b/Core/BaseUIPublic/EdgeInsetsExtensions.swift similarity index 97% rename from Core/BaseUI/EdgeInsetsExtensions.swift rename to Core/BaseUIPublic/EdgeInsetsExtensions.swift index 7eab9c18..e32ce21f 100644 --- a/Core/BaseUI/EdgeInsetsExtensions.swift +++ b/Core/BaseUIPublic/EdgeInsetsExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseTiny +import BaseTinyPublic extension EdgeInsets { public var contentOrigin: CGPoint { diff --git a/Core/BaseUI/FontExtensions.swift b/Core/BaseUIPublic/FontExtensions.swift similarity index 99% rename from Core/BaseUI/FontExtensions.swift rename to Core/BaseUIPublic/FontExtensions.swift index 7d5093cd..9a902963 100644 --- a/Core/BaseUI/FontExtensions.swift +++ b/Core/BaseUIPublic/FontExtensions.swift @@ -4,7 +4,7 @@ import CoreGraphics import CoreText import Foundation -import BaseTiny +import BaseTinyPublic extension Font { public class func with( diff --git a/Core/BaseUI/FontSettings.swift b/Core/BaseUIPublic/FontSettings.swift similarity index 100% rename from Core/BaseUI/FontSettings.swift rename to Core/BaseUIPublic/FontSettings.swift diff --git a/Core/BaseUI/FontSpecifying.swift b/Core/BaseUIPublic/FontSpecifying.swift similarity index 97% rename from Core/BaseUI/FontSpecifying.swift rename to Core/BaseUIPublic/FontSpecifying.swift index f21c109a..d1c39db6 100644 --- a/Core/BaseUI/FontSpecifying.swift +++ b/Core/BaseUIPublic/FontSpecifying.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseTiny +import BaseTinyPublic public protocol FontSpecifying: AnyObject { func font(weight: FontWeight, size: CGFloat) -> Font diff --git a/Core/BaseUI/ImageExtensions.swift b/Core/BaseUIPublic/ImageExtensions.swift similarity index 98% rename from Core/BaseUI/ImageExtensions.swift rename to Core/BaseUIPublic/ImageExtensions.swift index a6e64e79..2f94ed81 100644 --- a/Core/BaseUI/ImageExtensions.swift +++ b/Core/BaseUIPublic/ImageExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseTiny +import BaseTinyPublic extension Image { public var orientationTransform: CGAffineTransform { diff --git a/Core/BaseUI/Label.swift b/Core/BaseUIPublic/Label.swift similarity index 99% rename from Core/BaseUI/Label.swift rename to Core/BaseUIPublic/Label.swift index 72026f32..06809517 100644 --- a/Core/BaseUI/Label.swift +++ b/Core/BaseUIPublic/Label.swift @@ -2,7 +2,7 @@ import UIKit -import BaseTiny +import BaseTinyPublic @objc(YCLabel) public final class Label: UIView { diff --git a/Core/BaseUI/NSAttributedStringExtensions.swift b/Core/BaseUIPublic/NSAttributedStringExtensions.swift similarity index 99% rename from Core/BaseUI/NSAttributedStringExtensions.swift rename to Core/BaseUIPublic/NSAttributedStringExtensions.swift index 8ceb4589..ddf7fa57 100644 --- a/Core/BaseUI/NSAttributedStringExtensions.swift +++ b/Core/BaseUIPublic/NSAttributedStringExtensions.swift @@ -10,7 +10,7 @@ import UIKit import AppKit #endif -import BaseTiny +import BaseTinyPublic extension NSAttributedString { public enum VerticalPosition { diff --git a/Core/BaseUI/PublicInterfaces.swift b/Core/BaseUIPublic/PublicInterfaces.swift similarity index 96% rename from Core/BaseUI/PublicInterfaces.swift rename to Core/BaseUIPublic/PublicInterfaces.swift index 981e663d..88290422 100644 --- a/Core/BaseUI/PublicInterfaces.swift +++ b/Core/BaseUIPublic/PublicInterfaces.swift @@ -2,7 +2,7 @@ import CoreGraphics -import BaseTiny +import BaseTinyPublic public var fontSpecifiers = FontSpecifiers( text: systemFontSpecifier, diff --git a/Core/BaseUI/SideInsets.swift b/Core/BaseUIPublic/SideInsets.swift similarity index 100% rename from Core/BaseUI/SideInsets.swift rename to Core/BaseUIPublic/SideInsets.swift diff --git a/Core/BaseUI/StringExtensions.swift b/Core/BaseUIPublic/StringExtensions.swift similarity index 95% rename from Core/BaseUI/StringExtensions.swift rename to Core/BaseUIPublic/StringExtensions.swift index d5c70831..ca2ebb8c 100644 --- a/Core/BaseUI/StringExtensions.swift +++ b/Core/BaseUIPublic/StringExtensions.swift @@ -1,7 +1,7 @@ import Foundation -import BaseTiny +import BaseTinyPublic extension String { public func with(typo: Typo) -> NSAttributedString { diff --git a/Core/BaseUI/Typo.swift b/Core/BaseUIPublic/Typo.swift similarity index 99% rename from Core/BaseUI/Typo.swift rename to Core/BaseUIPublic/Typo.swift index a995ef0a..0dd582f5 100644 --- a/Core/BaseUI/Typo.swift +++ b/Core/BaseUIPublic/Typo.swift @@ -4,7 +4,7 @@ import CoreGraphics import CoreText import Foundation -import BaseTiny +import BaseTinyPublic private let DKParagraphStyleAttributeName = NSAttributedString.Key("DKParagraphStyle") private let DKAllowHeightOverrunAttributeName = NSAttributedString.Key("DKAllowHeightOverrun") diff --git a/Core/BaseUI/UIDeviceExtensions.swift b/Core/BaseUIPublic/UIDeviceExtensions.swift similarity index 100% rename from Core/BaseUI/UIDeviceExtensions.swift rename to Core/BaseUIPublic/UIDeviceExtensions.swift diff --git a/Core/BaseUI/UIImageExtensions.swift b/Core/BaseUIPublic/UIImageExtensions.swift similarity index 97% rename from Core/BaseUI/UIImageExtensions.swift rename to Core/BaseUIPublic/UIImageExtensions.swift index 5a8316f0..0fd95e90 100644 --- a/Core/BaseUI/UIImageExtensions.swift +++ b/Core/BaseUIPublic/UIImageExtensions.swift @@ -3,7 +3,7 @@ import Foundation import UIKit -import BaseTiny +import BaseTinyPublic extension UIImage { private static func delayForImage(at index: Int, source: CGImageSource) -> Double { @@ -82,7 +82,7 @@ extension UIImage { extension Array where Element == Int { fileprivate var gcd: Int { guard !isEmpty else { return 0 } - return reduce(0) { BaseUI.gcd($0, $1) } + return reduce(0) { BaseUIPublic.gcd($0, $1) } } } diff --git a/Core/BaseUI/UIImageViewExtensions.swift b/Core/BaseUIPublic/UIImageViewExtensions.swift similarity index 100% rename from Core/BaseUI/UIImageViewExtensions.swift rename to Core/BaseUIPublic/UIImageViewExtensions.swift diff --git a/Core/BaseUI/UIMenuControllerExtensions.swift b/Core/BaseUIPublic/UIMenuControllerExtensions.swift similarity index 100% rename from Core/BaseUI/UIMenuControllerExtensions.swift rename to Core/BaseUIPublic/UIMenuControllerExtensions.swift diff --git a/Core/BaseUI/UserInterfaceStyle.swift b/Core/BaseUIPublic/UserInterfaceStyle.swift similarity index 100% rename from Core/BaseUI/UserInterfaceStyle.swift rename to Core/BaseUIPublic/UserInterfaceStyle.swift diff --git a/Core/CommonCore/ImageViewBackgroundModel.swift b/Core/CommonCore/ImageViewBackgroundModel.swift index cd831d78..0d92d918 100644 --- a/Core/CommonCore/ImageViewBackgroundModel.swift +++ b/Core/CommonCore/ImageViewBackgroundModel.swift @@ -25,6 +25,7 @@ extension Optional where Wrapped == ImageViewBackgroundModel { view.subviews.filter { $0 == oldValue?.view }.forEach { $0.removeFromSuperview() } view.backgroundColor = self?.color if let backgroundView = self?.view { + backgroundView.frame = view.bounds backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] view.addSubview(backgroundView) } diff --git a/Core/CommonCore/CacheRecord.swift b/Core/CommonCorePublic/CacheRecord.swift similarity index 100% rename from Core/CommonCore/CacheRecord.swift rename to Core/CommonCorePublic/CacheRecord.swift diff --git a/Core/CommonCore/CacheStorage.swift b/Core/CommonCorePublic/CacheStorage.swift similarity index 100% rename from Core/CommonCore/CacheStorage.swift rename to Core/CommonCorePublic/CacheStorage.swift diff --git a/Core/CommonCore/CompletionAccumulating.swift b/Core/CommonCorePublic/CompletionAccumulating.swift similarity index 100% rename from Core/CommonCore/CompletionAccumulating.swift rename to Core/CommonCorePublic/CompletionAccumulating.swift diff --git a/Core/CommonCore/CompletionAccumulator.swift b/Core/CommonCorePublic/CompletionAccumulator.swift similarity index 100% rename from Core/CommonCore/CompletionAccumulator.swift rename to Core/CommonCorePublic/CompletionAccumulator.swift diff --git a/Core/CommonCore/CompoundScrollDelegate.swift b/Core/CommonCorePublic/CompoundScrollDelegate.swift similarity index 100% rename from Core/CommonCore/CompoundScrollDelegate.swift rename to Core/CommonCorePublic/CompoundScrollDelegate.swift diff --git a/Core/CommonCore/ExclusiveTouchCollectionView.swift b/Core/CommonCorePublic/ExclusiveTouchCollectionView.swift similarity index 100% rename from Core/CommonCore/ExclusiveTouchCollectionView.swift rename to Core/CommonCorePublic/ExclusiveTouchCollectionView.swift diff --git a/Core/CommonCore/Exported.swift b/Core/CommonCorePublic/Exported.swift similarity index 64% rename from Core/CommonCore/Exported.swift rename to Core/CommonCorePublic/Exported.swift index a9e8dd76..20fa8379 100644 --- a/Core/CommonCore/Exported.swift +++ b/Core/CommonCorePublic/Exported.swift @@ -1,3 +1,3 @@ // Copyright 2021 Yandex LLC. All rights reserved. -@_exported import Base +@_exported import BasePublic diff --git a/Core/CommonCore/HTMLEntities.swift b/Core/CommonCorePublic/HTMLEntities.swift similarity index 100% rename from Core/CommonCore/HTMLEntities.swift rename to Core/CommonCorePublic/HTMLEntities.swift diff --git a/Core/CommonCore/HTMLEntitiesResolver.swift b/Core/CommonCorePublic/HTMLEntitiesResolver.swift similarity index 100% rename from Core/CommonCore/HTMLEntitiesResolver.swift rename to Core/CommonCorePublic/HTMLEntitiesResolver.swift diff --git a/Core/CommonCore/HTMLParser.swift b/Core/CommonCorePublic/HTMLParser.swift similarity index 98% rename from Core/CommonCore/HTMLParser.swift rename to Core/CommonCorePublic/HTMLParser.swift index a502fc86..716219a0 100644 --- a/Core/CommonCore/HTMLParser.swift +++ b/Core/CommonCorePublic/HTMLParser.swift @@ -2,7 +2,7 @@ import Foundation -import BaseUI +import BaseUIPublic public final class HTMLParser { private let resolver = HTMLEntitiesResolver() diff --git a/Core/CommonCore/HTMLParserDelegate.swift b/Core/CommonCorePublic/HTMLParserDelegate.swift similarity index 100% rename from Core/CommonCore/HTMLParserDelegate.swift rename to Core/CommonCorePublic/HTMLParserDelegate.swift diff --git a/Core/CommonCore/HTMLTag.swift b/Core/CommonCorePublic/HTMLTag.swift similarity index 100% rename from Core/CommonCore/HTMLTag.swift rename to Core/CommonCorePublic/HTMLTag.swift diff --git a/Core/CommonCore/HTMLTaggedString.swift b/Core/CommonCorePublic/HTMLTaggedString.swift similarity index 96% rename from Core/CommonCore/HTMLTaggedString.swift rename to Core/CommonCorePublic/HTMLTaggedString.swift index 199a45fe..799f5f6d 100644 --- a/Core/CommonCore/HTMLTaggedString.swift +++ b/Core/CommonCorePublic/HTMLTaggedString.swift @@ -2,7 +2,7 @@ import Foundation -import BaseUI +import BaseUIPublic struct HTMLTaggedString: CustomStringConvertible { let text: String diff --git a/Core/CommonCore/ImageContaining.swift b/Core/CommonCorePublic/ImageContaining.swift similarity index 100% rename from Core/CommonCore/ImageContaining.swift rename to Core/CommonCorePublic/ImageContaining.swift diff --git a/Core/CommonCore/ImageLayerLayout.swift b/Core/CommonCorePublic/ImageLayerLayout.swift similarity index 100% rename from Core/CommonCore/ImageLayerLayout.swift rename to Core/CommonCorePublic/ImageLayerLayout.swift diff --git a/Core/CommonCore/ImageRedrawingStyle.swift b/Core/CommonCorePublic/ImageRedrawingStyle.swift similarity index 96% rename from Core/CommonCore/ImageRedrawingStyle.swift rename to Core/CommonCorePublic/ImageRedrawingStyle.swift index 599b2626..a390d8fc 100644 --- a/Core/CommonCore/ImageRedrawingStyle.swift +++ b/Core/CommonCorePublic/ImageRedrawingStyle.swift @@ -1,6 +1,6 @@ // Copyright 2022 Yandex LLC. All rights reserved. -import BaseUI +import BaseUIPublic public struct ImageRedrawingStyle: Equatable { public static func ==(lhs: ImageRedrawingStyle, rhs: ImageRedrawingStyle) -> Bool { diff --git a/Core/CommonCorePublic/ImageViewBackgroundModel.swift b/Core/CommonCorePublic/ImageViewBackgroundModel.swift new file mode 100644 index 00000000..cd831d78 --- /dev/null +++ b/Core/CommonCorePublic/ImageViewBackgroundModel.swift @@ -0,0 +1,54 @@ +// Copyright 2023 Yandex LLC. All rights reserved. + +import UIKit + +public enum ImageViewBackgroundModel { + case color(Color) + case view(UIView) +} + +extension ImageViewBackgroundModel { + public init?(placeholder: ImagePlaceholder) { + switch placeholder { + case let .color(color): + self = .color(color) + case let .view(view): + self = .view(view) + case .image: + return nil + } + } +} + +extension Optional where Wrapped == ImageViewBackgroundModel { + public func applyTo(_ view: UIView, oldValue: Self) { + view.subviews.filter { $0 == oldValue?.view }.forEach { $0.removeFromSuperview() } + view.backgroundColor = self?.color + if let backgroundView = self?.view { + backgroundView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + view.addSubview(backgroundView) + } + } +} + +extension ImageViewBackgroundModel { + fileprivate var view: UIView? { + switch self { + case .color: + return nil + case let .view(view): + return view + } + } +} + +extension ImageViewBackgroundModel { + fileprivate var color: UIColor? { + switch self { + case let .color(color): + return color.systemColor + case .view: + return nil + } + } +} diff --git a/Core/CommonCore/ImageViewProtocol.swift b/Core/CommonCorePublic/ImageViewProtocol.swift similarity index 100% rename from Core/CommonCore/ImageViewProtocol.swift rename to Core/CommonCorePublic/ImageViewProtocol.swift diff --git a/Core/CommonCore/LRUCacheStorage.swift b/Core/CommonCorePublic/LRUCacheStorage.swift similarity index 100% rename from Core/CommonCore/LRUCacheStorage.swift rename to Core/CommonCorePublic/LRUCacheStorage.swift diff --git a/Core/CommonCore/LRUMemoization.swift b/Core/CommonCorePublic/LRUMemoization.swift similarity index 100% rename from Core/CommonCore/LRUMemoization.swift rename to Core/CommonCorePublic/LRUMemoization.swift diff --git a/Core/CommonCore/LinkedListOrderedDictionary.swift b/Core/CommonCorePublic/LinkedListOrderedDictionary.swift similarity index 100% rename from Core/CommonCore/LinkedListOrderedDictionary.swift rename to Core/CommonCorePublic/LinkedListOrderedDictionary.swift diff --git a/Core/CommonCore/MetalImageView.swift b/Core/CommonCorePublic/MetalImageView.swift similarity index 99% rename from Core/CommonCore/MetalImageView.swift rename to Core/CommonCorePublic/MetalImageView.swift index 96639f7b..133aefb5 100644 --- a/Core/CommonCore/MetalImageView.swift +++ b/Core/CommonCorePublic/MetalImageView.swift @@ -3,7 +3,7 @@ import MetalKit import UIKit -import BaseUI +import BaseUIPublic public final class MetalImageView: UIView, RemoteImageViewContentProtocol { public var appearanceAnimation: ImageViewAnimation? diff --git a/Core/CommonCore/NSAttributedStringExtensions.swift b/Core/CommonCorePublic/NSAttributedStringExtensions.swift similarity index 98% rename from Core/CommonCore/NSAttributedStringExtensions.swift rename to Core/CommonCorePublic/NSAttributedStringExtensions.swift index 28510da2..182a1f32 100644 --- a/Core/CommonCore/NSAttributedStringExtensions.swift +++ b/Core/CommonCorePublic/NSAttributedStringExtensions.swift @@ -3,7 +3,7 @@ import CoreGraphics import Foundation -import BaseUI +import BaseUIPublic extension NSAttributedString { public var isEmpty: Bool { diff --git a/Core/CommonCore/ObjectsReusability.swift b/Core/CommonCorePublic/ObjectsReusability.swift similarity index 100% rename from Core/CommonCore/ObjectsReusability.swift rename to Core/CommonCorePublic/ObjectsReusability.swift diff --git a/Core/CommonCore/OrderedDictionary.swift b/Core/CommonCorePublic/OrderedDictionary.swift similarity index 100% rename from Core/CommonCore/OrderedDictionary.swift rename to Core/CommonCorePublic/OrderedDictionary.swift diff --git a/Core/CommonCore/RemoteImageView.swift b/Core/CommonCorePublic/RemoteImageView.swift similarity index 100% rename from Core/CommonCore/RemoteImageView.swift rename to Core/CommonCorePublic/RemoteImageView.swift diff --git a/Core/CommonCore/RemoteImageViewContainer.swift b/Core/CommonCorePublic/RemoteImageViewContainer.swift similarity index 100% rename from Core/CommonCore/RemoteImageViewContainer.swift rename to Core/CommonCorePublic/RemoteImageViewContainer.swift diff --git a/Core/CommonCore/RemoteImageViewContentProtocol.swift b/Core/CommonCorePublic/RemoteImageViewContentProtocol.swift similarity index 100% rename from Core/CommonCore/RemoteImageViewContentProtocol.swift rename to Core/CommonCorePublic/RemoteImageViewContentProtocol.swift diff --git a/Core/CommonCore/Resetting.swift b/Core/CommonCorePublic/Resetting.swift similarity index 100% rename from Core/CommonCore/Resetting.swift rename to Core/CommonCorePublic/Resetting.swift diff --git a/Core/CommonCore/ScrollableContent.swift b/Core/CommonCorePublic/ScrollableContent.swift similarity index 100% rename from Core/CommonCore/ScrollableContent.swift rename to Core/CommonCorePublic/ScrollableContent.swift diff --git a/Core/CommonCore/SizedItem.swift b/Core/CommonCorePublic/SizedItem.swift similarity index 100% rename from Core/CommonCore/SizedItem.swift rename to Core/CommonCorePublic/SizedItem.swift diff --git a/Core/CommonCore/Theme.swift b/Core/CommonCorePublic/Theme.swift similarity index 97% rename from Core/CommonCore/Theme.swift rename to Core/CommonCorePublic/Theme.swift index a7ea98c0..71b5fa1b 100644 --- a/Core/CommonCore/Theme.swift +++ b/Core/CommonCorePublic/Theme.swift @@ -2,7 +2,7 @@ import SwiftUI -import BaseUI +import BaseUIPublic @frozen public enum Theme: String { diff --git a/Core/CommonCore/UIStyles.swift b/Core/CommonCorePublic/UIStyles.swift similarity index 100% rename from Core/CommonCore/UIStyles.swift rename to Core/CommonCorePublic/UIStyles.swift diff --git a/Core/CommonCore/ViewProtocol.swift b/Core/CommonCorePublic/ViewProtocol.swift similarity index 100% rename from Core/CommonCore/ViewProtocol.swift rename to Core/CommonCorePublic/ViewProtocol.swift diff --git a/Core/CommonCore/VisibleBoundsTracking.swift b/Core/CommonCorePublic/VisibleBoundsTracking.swift similarity index 100% rename from Core/CommonCore/VisibleBoundsTracking.swift rename to Core/CommonCorePublic/VisibleBoundsTracking.swift diff --git a/Core/Networking/ActiveRequestsTracker.swift b/Core/NetworkingPublic/ActiveRequestsTracker.swift similarity index 100% rename from Core/Networking/ActiveRequestsTracker.swift rename to Core/NetworkingPublic/ActiveRequestsTracker.swift diff --git a/Core/Networking/AsyncResourceRequester.swift b/Core/NetworkingPublic/AsyncResourceRequester.swift similarity index 99% rename from Core/Networking/AsyncResourceRequester.swift rename to Core/NetworkingPublic/AsyncResourceRequester.swift index 6bc4be60..a24f17a7 100644 --- a/Core/Networking/AsyncResourceRequester.swift +++ b/Core/NetworkingPublic/AsyncResourceRequester.swift @@ -1,6 +1,6 @@ // Copyright 2019 Yandex LLC. All rights reserved. -import Base +import BasePublic public final class AsyncResourceRequester { public typealias Completion = (Resource?) -> Void diff --git a/Core/Networking/AuthChallengeHandler.swift b/Core/NetworkingPublic/AuthChallengeHandler.swift similarity index 100% rename from Core/Networking/AuthChallengeHandler.swift rename to Core/NetworkingPublic/AuthChallengeHandler.swift diff --git a/Core/Networking/ChallengeHandling.swift b/Core/NetworkingPublic/ChallengeHandling.swift similarity index 100% rename from Core/Networking/ChallengeHandling.swift rename to Core/NetworkingPublic/ChallengeHandling.swift diff --git a/Core/Networking/DataExtensions.swift b/Core/NetworkingPublic/DataExtensions.swift similarity index 100% rename from Core/Networking/DataExtensions.swift rename to Core/NetworkingPublic/DataExtensions.swift diff --git a/Core/Networking/HTTPCode.swift b/Core/NetworkingPublic/HTTPCode.swift similarity index 100% rename from Core/Networking/HTTPCode.swift rename to Core/NetworkingPublic/HTTPCode.swift diff --git a/Core/Networking/HTTPErrors.swift b/Core/NetworkingPublic/HTTPErrors.swift similarity index 100% rename from Core/Networking/HTTPErrors.swift rename to Core/NetworkingPublic/HTTPErrors.swift diff --git a/Core/Networking/HTTPHeaders.swift b/Core/NetworkingPublic/HTTPHeaders.swift similarity index 100% rename from Core/Networking/HTTPHeaders.swift rename to Core/NetworkingPublic/HTTPHeaders.swift diff --git a/Core/Networking/ImageHolderFactory.swift b/Core/NetworkingPublic/ImageHolderFactory.swift similarity index 99% rename from Core/Networking/ImageHolderFactory.swift rename to Core/NetworkingPublic/ImageHolderFactory.swift index c2d749f1..920063d2 100644 --- a/Core/Networking/ImageHolderFactory.swift +++ b/Core/NetworkingPublic/ImageHolderFactory.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public struct ImageHolderFactory { private let _make: (URL?, ImagePlaceholder?) -> ImageHolder diff --git a/Core/Networking/LocalImageProviding.swift b/Core/NetworkingPublic/LocalImageProviding.swift similarity index 89% rename from Core/Networking/LocalImageProviding.swift rename to Core/NetworkingPublic/LocalImageProviding.swift index a2ac7ed8..4532ac28 100644 --- a/Core/Networking/LocalImageProviding.swift +++ b/Core/NetworkingPublic/LocalImageProviding.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public protocol LocalImageProviding { func localImage(for url: URL) -> ImageHolder? diff --git a/Core/Networking/NSErrorExtensions.swift b/Core/NetworkingPublic/NSErrorExtensions.swift similarity index 100% rename from Core/Networking/NSErrorExtensions.swift rename to Core/NetworkingPublic/NSErrorExtensions.swift diff --git a/Core/Networking/NetworkActivityIndicatorController.swift b/Core/NetworkingPublic/NetworkActivityIndicatorController.swift similarity index 100% rename from Core/Networking/NetworkActivityIndicatorController.swift rename to Core/NetworkingPublic/NetworkActivityIndicatorController.swift diff --git a/Core/Networking/NetworkSessionMetrics.swift b/Core/NetworkingPublic/NetworkSessionMetrics.swift similarity index 100% rename from Core/Networking/NetworkSessionMetrics.swift rename to Core/NetworkingPublic/NetworkSessionMetrics.swift diff --git a/Core/Networking/NetworkURLResourceRequester.swift b/Core/NetworkingPublic/NetworkURLResourceRequester.swift similarity index 97% rename from Core/Networking/NetworkURLResourceRequester.swift rename to Core/NetworkingPublic/NetworkURLResourceRequester.swift index efbce636..68ffdfac 100644 --- a/Core/Networking/NetworkURLResourceRequester.swift +++ b/Core/NetworkingPublic/NetworkURLResourceRequester.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public final class NetworkURLResourceRequester: URLResourceRequesting { private let performer: URLRequestPerforming diff --git a/Core/Networking/RemoteImageHolder.swift b/Core/NetworkingPublic/RemoteImageHolder.swift similarity index 99% rename from Core/Networking/RemoteImageHolder.swift rename to Core/NetworkingPublic/RemoteImageHolder.swift index 9977042a..8595ecd9 100644 --- a/Core/Networking/RemoteImageHolder.swift +++ b/Core/NetworkingPublic/RemoteImageHolder.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public final class RemoteImageHolder: ImageHolder { private typealias AsyncImageRequester = (@escaping ((Image, URLRequestResult.Source)?) -> Void) diff --git a/Core/Networking/Resource.swift b/Core/NetworkingPublic/Resource.swift similarity index 99% rename from Core/Networking/Resource.swift rename to Core/NetworkingPublic/Resource.swift index 6cc58f57..799d8e5f 100644 --- a/Core/Networking/Resource.swift +++ b/Core/NetworkingPublic/Resource.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public enum HTTPMethod: String { case GET diff --git a/Core/Networking/TimeTracking.swift b/Core/NetworkingPublic/TimeTracking.swift similarity index 100% rename from Core/Networking/TimeTracking.swift rename to Core/NetworkingPublic/TimeTracking.swift diff --git a/Core/Networking/URLRequestPerformer.swift b/Core/NetworkingPublic/URLRequestPerformer.swift similarity index 99% rename from Core/Networking/URLRequestPerformer.swift rename to Core/NetworkingPublic/URLRequestPerformer.swift index e07107a2..b75a459e 100644 --- a/Core/Networking/URLRequestPerformer.swift +++ b/Core/NetworkingPublic/URLRequestPerformer.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public final class URLRequestPerformer: URLRequestPerforming { public enum ChallengeHandler { diff --git a/Core/Networking/URLRequestPerforming.swift b/Core/NetworkingPublic/URLRequestPerforming.swift similarity index 98% rename from Core/Networking/URLRequestPerforming.swift rename to Core/NetworkingPublic/URLRequestPerforming.swift index 26bf68f0..146ac731 100644 --- a/Core/Networking/URLRequestPerforming.swift +++ b/Core/NetworkingPublic/URLRequestPerforming.swift @@ -2,7 +2,7 @@ import Foundation -import Base +import BasePublic public protocol NetworkTask: AnyObject, Cancellable { var taskDescription: String? { get set } diff --git a/Core/Networking/URLSessionDelegateImpl.swift b/Core/NetworkingPublic/URLSessionDelegateImpl.swift similarity index 100% rename from Core/Networking/URLSessionDelegateImpl.swift rename to Core/NetworkingPublic/URLSessionDelegateImpl.swift diff --git a/Core/Networking/URLSessionTaskMetricsExtensions.swift b/Core/NetworkingPublic/URLSessionTaskMetricsExtensions.swift similarity index 100% rename from Core/Networking/URLSessionTaskMetricsExtensions.swift rename to Core/NetworkingPublic/URLSessionTaskMetricsExtensions.swift diff --git a/Core/Networking/URLTransform.swift b/Core/NetworkingPublic/URLTransform.swift similarity index 100% rename from Core/Networking/URLTransform.swift rename to Core/NetworkingPublic/URLTransform.swift diff --git a/Core/Networking/iOS.swift b/Core/NetworkingPublic/iOS.swift similarity index 100% rename from Core/Networking/iOS.swift rename to Core/NetworkingPublic/iOS.swift diff --git a/DivKit/Actions/DivActionHandler.swift b/DivKit/Actions/DivActionHandler.swift index 22783ba6..74c3cd7f 100644 --- a/DivKit/Actions/DivActionHandler.swift +++ b/DivKit/Actions/DivActionHandler.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import LayoutKit import Serialization import TemplatesSupport diff --git a/DivKit/Actions/DivActionIntent.swift b/DivKit/Actions/DivActionIntent.swift index 1ec0dd26..7e8e866b 100644 --- a/DivKit/Actions/DivActionIntent.swift +++ b/DivKit/Actions/DivActionIntent.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface enum DivActionIntent { diff --git a/DivKit/Actions/DivActionLogger.swift b/DivKit/Actions/DivActionLogger.swift index 0c98e96d..7f039547 100644 --- a/DivKit/Actions/DivActionLogger.swift +++ b/DivKit/Actions/DivActionLogger.swift @@ -1,7 +1,7 @@ import Foundation -import Base -import Networking +import BasePublic +import NetworkingPublic import Serialization public protocol DivActionLogger { diff --git a/DivKit/Actions/DivActionURLHandler.swift b/DivKit/Actions/DivActionURLHandler.swift index 5d808941..fa4128f5 100644 --- a/DivKit/Actions/DivActionURLHandler.swift +++ b/DivKit/Actions/DivActionURLHandler.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKit public final class DivActionURLHandler { @@ -58,7 +58,7 @@ public final class DivActionURLHandler { public func handleURL( _ url: URL, - cardId: DivCardID?, + cardId: DivCardID, completion: @escaping (Result) -> Void = { _ in } ) -> Bool { guard let intent = DivActionIntent(url: url) else { @@ -71,9 +71,6 @@ public final class DivActionURLHandler { case .hideTooltip: return false case let .download(patchUrl): - guard let cardId = cardId else { - return false - } patchProvider.getPatch( url: patchUrl, completion: { [unowned self] in @@ -81,9 +78,6 @@ public final class DivActionURLHandler { } ) case let .setState(divStatePath, lifetime): - guard let cardId = cardId else { - return false - } stateUpdater.set( path: divStatePath, cardId: cardId, @@ -91,9 +85,6 @@ public final class DivActionURLHandler { ) updateCard(.state(cardId)) case let .setVariable(name, value): - guard let cardId = cardId else { - return false - } variableUpdater.update( cardId: cardId, name: DivVariableName(rawValue: name), @@ -101,14 +92,14 @@ public final class DivActionURLHandler { ) case let .setCurrentItem(id, index): setCurrentItem(id: id, index: index) + updateCard(.state(cardId)) case let .setNextItem(id, overflow): setNextItem(id: id, overflow: overflow) + updateCard(.state(cardId)) case let .setPreviousItem(id, overflow): setPreviousItem(id: id, overflow: overflow) + updateCard(.state(cardId)) case let .timer(timerId, action): - guard let cardId = cardId else { - return false - } performTimerAction(cardId, timerId, action) } @@ -132,12 +123,11 @@ public final class DivActionURLHandler { private func setCurrentItem(id: String, index: Int) { switch blockStateStorage.getStateUntyped(id) { case let galleryState as GalleryViewState: - switch galleryState.contentPosition { - case .offset: - return - case .paging: - setGalleryCurrentItem(id: id, index: Int(index)) - } + setGalleryCurrentItem( + id: id, + index: index, + itemsCount: galleryState.itemsCount + ) case let pagerState as PagerViewState: setPagerCurrentItem( id: id, @@ -154,12 +144,16 @@ public final class DivActionURLHandler { private func setNextItem(id: String, overflow: OverflowMode) { switch blockStateStorage.getStateUntyped(id) { case let galleryState as GalleryViewState: - switch galleryState.contentPosition { - case .offset: - return - case let .paging(index): - setGalleryCurrentItem(id: id, index: Int(index) + 1) - } + let index = getNextIndex( + current: galleryState.currentItemIndex, + count: galleryState.itemsCount, + overflow: overflow + ) + setGalleryCurrentItem( + id: id, + index: index, + itemsCount: galleryState.itemsCount + ) case let pagerState as PagerViewState: let nextIndex = getNextIndex( current: Int(pagerState.currentPage), @@ -203,12 +197,16 @@ public final class DivActionURLHandler { private func setPreviousItem(id: String, overflow: OverflowMode) { switch blockStateStorage.getStateUntyped(id) { case let galleryState as GalleryViewState: - switch galleryState.contentPosition { - case .offset: - return - case let .paging(index): - setGalleryCurrentItem(id: id, index: Int(index) - 1) - } + let index = getPreviousIndex( + current: galleryState.currentItemIndex, + count: galleryState.itemsCount, + overflow: overflow + ) + setGalleryCurrentItem( + id: id, + index: index, + itemsCount: galleryState.itemsCount + ) case let pagerState as PagerViewState: let prevIndex = getPreviousIndex( current: Int(pagerState.currentPage), @@ -249,10 +247,17 @@ public final class DivActionURLHandler { } } - private func setGalleryCurrentItem(id: String, index: Int) { + private func setGalleryCurrentItem( + id: String, + index: Int, + itemsCount: Int + ) { blockStateStorage.setState( id: id, - state: GalleryViewState(contentPageIndex: CGFloat(max(0, index))) + state: GalleryViewState( + contentPageIndex: CGFloat(max(0, index)), + itemsCount: itemsCount + ) ) } @@ -281,3 +286,14 @@ public final class DivActionURLHandler { ) } } + +extension GalleryViewState { + fileprivate var currentItemIndex: Int { + switch contentPosition { + case let .offset(_, firstVisibleItemsIndex): + return firstVisibleItemsIndex + case let .paging(index): + return Int(index) + } + } +} diff --git a/DivKit/Debug/Block+DebugInfo.swift b/DivKit/Debug/Block+DebugInfo.swift index 45bfe744..d9ecdff6 100644 --- a/DivKit/Debug/Block+DebugInfo.swift +++ b/DivKit/Debug/Block+DebugInfo.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension Block { diff --git a/DivKit/Debug/ErrorListView.swift b/DivKit/Debug/ErrorListView.swift index 1e66489b..422b5164 100644 --- a/DivKit/Debug/ErrorListView.swift +++ b/DivKit/Debug/ErrorListView.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import BaseUI +import BaseUIPublic import LayoutKit final class ErrorListView: UIView { @@ -18,9 +18,7 @@ final class ErrorListView: UIView { } public override func layoutSubviews() { - if #available(iOS 11.0, *) { - self.listView.frame = self.bounds.inset(by: safeAreaInsets) - } + self.listView.frame = self.bounds.inset(by: safeAreaInsets) } @available(*, unavailable) diff --git a/DivKit/DivBlockModeling.swift b/DivKit/DivBlockModeling.swift index 1f819a6f..66cf7fd3 100644 --- a/DivKit/DivBlockModeling.swift +++ b/DivKit/DivBlockModeling.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit public protocol DivBlockModeling { diff --git a/DivKit/DivBlockModelingActionContext.swift b/DivKit/DivBlockModelingActionContext.swift index 7c4f3443..2a5415cc 100644 --- a/DivKit/DivBlockModelingActionContext.swift +++ b/DivKit/DivBlockModelingActionContext.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit struct DivBlockModelingActionContext { diff --git a/DivKit/DivBlockModelingContext.swift b/DivKit/DivBlockModelingContext.swift index 889a45fe..8534c086 100644 --- a/DivKit/DivBlockModelingContext.swift +++ b/DivKit/DivBlockModelingContext.swift @@ -1,9 +1,9 @@ import CoreGraphics -import Base -import BaseUI +import BasePublic +import BaseUIPublic import LayoutKit -import Networking +import NetworkingPublic import Serialization public struct DivBlockModelingContext { @@ -42,7 +42,7 @@ public struct DivBlockModelingContext { imageHolderFactory: ImageHolderFactory, highPriorityImageHolderFactory: ImageHolderFactory? = nil, divCustomBlockFactory: DivCustomBlockFactory = EmptyDivCustomBlockFactory(), - fontSpecifiers: FontSpecifiers = BaseUI.fontSpecifiers, + fontSpecifiers: FontSpecifiers = BaseUIPublic.fontSpecifiers, flagsInfo: DivFlagsInfo = .default, extensionHandlers: [DivExtensionHandler] = [], stateInterceptors: [DivStateInterceptor] = [], diff --git a/DivKit/DivErrorsStorage.swift b/DivKit/DivErrorsStorage.swift index 4b2014e6..e00edac8 100644 --- a/DivKit/DivErrorsStorage.swift +++ b/DivKit/DivErrorsStorage.swift @@ -1,4 +1,4 @@ -import Base +import BasePublic import Serialization public typealias DivError = CustomStringConvertible diff --git a/DivKit/DivExtensionHandler.swift b/DivKit/DivExtensionHandler.swift index 447d9c6d..40acc0c3 100644 --- a/DivKit/DivExtensionHandler.swift +++ b/DivKit/DivExtensionHandler.swift @@ -1,7 +1,7 @@ import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit public protocol DivExtensionHandler: AccessibilityContaining { diff --git a/DivKit/DivKitComponents.swift b/DivKit/DivKitComponents.swift index b2b973ba..b861b3a4 100644 --- a/DivKit/DivKitComponents.swift +++ b/DivKit/DivKitComponents.swift @@ -1,9 +1,9 @@ import Foundation -import Base -import BaseUI +import BasePublic +import BaseUIPublic import LayoutKit -import Networking +import NetworkingPublic import Serialization public final class DivKitComponents { @@ -30,7 +30,7 @@ public final class DivKitComponents { divCustomBlockFactory: DivCustomBlockFactory = EmptyDivCustomBlockFactory(), extensionHandlers: [DivExtensionHandler] = [], flagsInfo: DivFlagsInfo = .default, - fontSpecifiers: FontSpecifiers = BaseUI.fontSpecifiers, + fontSpecifiers: FontSpecifiers = BaseUIPublic.fontSpecifiers, imageHolderFactory: ImageHolderFactory? = nil, patchProvider: DivPatchProvider? = nil, requestPerformer: URLRequestPerforming? = nil, diff --git a/DivKit/DivKitInfo.swift b/DivKit/DivKitInfo.swift index c943c24c..9fdf5d01 100644 --- a/DivKit/DivKitInfo.swift +++ b/DivKit/DivKitInfo.swift @@ -1,3 +1,3 @@ public enum DivKitInfo { - public static let version = "23.7.0" + public static let version = "24.0.0" } diff --git a/DivKit/DivStatePath.swift b/DivKit/DivStatePath.swift index 15579e0d..69c34037 100644 --- a/DivKit/DivStatePath.swift +++ b/DivKit/DivStatePath.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit public enum CardIDTag {} diff --git a/DivKit/DivVisibilityCounter.swift b/DivKit/DivVisibilityCounter.swift index 1367756d..2a9f49f3 100644 --- a/DivKit/DivVisibilityCounter.swift +++ b/DivKit/DivVisibilityCounter.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit public protocol DivVisibilityCounting { diff --git a/DivKit/Expressions/CalcExpression/AnyCalcExpression.swift b/DivKit/Expressions/CalcExpression/AnyCalcExpression.swift index fbf73768..933de9a6 100644 --- a/DivKit/Expressions/CalcExpression/AnyCalcExpression.swift +++ b/DivKit/Expressions/CalcExpression/AnyCalcExpression.swift @@ -33,7 +33,7 @@ import Foundation -import CommonCore +import CommonCorePublic protocol ConstantsProvider { func getValue(_ name: String) -> Any? @@ -685,7 +685,11 @@ extension AnyCalcExpression { case let floatValue as Float: return .number(Double(floatValue)) case is Int, is UInt, is Int32, is UInt32, is Int64, is UInt64: - return try cast(Double(truncating: value as! NSNumber)) + if let intValue = value as? Int { + return .integer(intValue) + } else { + throw CalcExpression.Value.integerOverflow() + } case let numberValue as NSNumber: // Hack to avoid losing type info for UIFont.Weight, etc if "\(value)".contains("rawValue") { @@ -705,15 +709,6 @@ extension AnyCalcExpression { return .number(Double(bitPattern: NanBox.bitPattern(for: values.count - 1))) } - private func cast(_ value: Double) throws -> CalcExpression.Value { - if Double(CalcExpression.Value.minInteger) <= value, - value <= Double(CalcExpression.Value.maxInteger) { - return .integer(Int(value)) - } else { - throw CalcExpression.Value.integerOverflow() - } - } - // Retrieve a value from the box, if it exists fileprivate func loadIfStored(_ arg: Double) -> Any? { switch arg.bitPattern { diff --git a/DivKit/Expressions/CalcExpression/CalcExpression.swift b/DivKit/Expressions/CalcExpression/CalcExpression.swift index 47568a9d..b02c4474 100644 --- a/DivKit/Expressions/CalcExpression/CalcExpression.swift +++ b/DivKit/Expressions/CalcExpression/CalcExpression.swift @@ -33,7 +33,7 @@ import Foundation -import CommonCore +import CommonCorePublic /// Immutable wrapper for a parsed expression /// Reusing the same CalcExpression instance for multiple evaluations is more efficient @@ -992,27 +992,29 @@ extension UnicodeScalarView { func scanNumber() -> Number? { var number: Number var endOfInt = self + let sign = scanCharacter { $0 == "-" } ?? "" if let integer = scanInteger() { if integer == "0", scanCharacter("x") { - return .integer("0x\(scanHex() ?? "")") + return .integer("\(sign)0x\(scanHex() ?? "")") } endOfInt = self if scanCharacter(".") { guard let fraction = scanInteger() else { self = endOfInt - return .number(integer) + return .number(sign + integer) } - number = .number("\(integer).\(fraction)") + number = .number("\(sign)\(integer).\(fraction)") } else { - number = .integer(integer) + number = .integer(sign + integer) } } else if scanCharacter(".") { guard let fraction = scanInteger() else { self = endOfInt return nil } - number = .number(".\(fraction)") + number = .number("\(sign).\(fraction)") } else { + self = endOfInt return nil } if let exponent = scanExponent() { @@ -1027,7 +1029,7 @@ extension UnicodeScalarView { switch number { case let .integer(value): guard let result = Int(value) else { - return .error(.unexpectedToken(value), value) + return .error(CalcExpression.Value.integerError(value), value) } return .literal(.integer(result)) case let .number(value): @@ -1305,6 +1307,14 @@ extension UnicodeScalarView { // Prepare for next iteration var followedByWhitespace = skipWhitespace() || isEmpty + func appendLiteralWithNegativeValue() { + operandPosition = false + if let last = stack.last, last.isOperand { + stack.append(.symbol(.infix("+"), [], nil)) + } + stack.append(expression) + } + switch expression { case let .symbol(.infix(name), _, _): switch name { @@ -1394,6 +1404,10 @@ extension UnicodeScalarView { case let .symbol(.variable(name), _, _) where !operandPosition: operandPosition = true stack.append(.symbol(.infix(name), [], nil)) + case let .literal(.integer(value)) where value < 0: + appendLiteralWithNegativeValue() + case let .literal(.number(value)) where value < 0: + appendLiteralWithNegativeValue() default: operandPosition = false stack.append(expression) diff --git a/DivKit/Expressions/CalcExpression/Value.swift b/DivKit/Expressions/CalcExpression/Value.swift index ef4b79b6..0c8ba4d0 100644 --- a/DivKit/Expressions/CalcExpression/Value.swift +++ b/DivKit/Expressions/CalcExpression/Value.swift @@ -25,8 +25,8 @@ extension CalcExpression.Value { } extension CalcExpression.Value { - static let maxInteger = 2_147_483_647 - static let minInteger = -2_147_483_648 + static let maxInteger = Int.max + static let minInteger = Int.min static func integerError(_ value: Any) -> AnyCalcExpression.Error { .message("Value \(value) can't be converted to Integer type.") } @@ -40,7 +40,11 @@ extension CalcExpression.Value { static func +(lhs: Self, rhs: Self) throws -> Self { switch (lhs, rhs) { case let (.integer(lValue), .integer(rValue)): - return .integer(lValue + rValue) + if case let (result, overflow) = lValue.addingReportingOverflow(rValue), !overflow { + return .integer(result) + } else { + throw CalcExpression.Value.integerOverflow() + } case let (.number(lValue), .number(rValue)): return .number(lValue + rValue) case let (.string(lValue), .string(rValue)): @@ -58,7 +62,11 @@ extension CalcExpression.Value { static func -(lhs: Self, rhs: Self) throws -> Self { switch (lhs, rhs) { case let (.integer(lValue), .integer(rValue)): - return .integer(lValue - rValue) + if case let (result, overflow) = lValue.subtractingReportingOverflow(rValue), !overflow { + return .integer(result) + } else { + throw CalcExpression.Value.integerOverflow() + } case let (.number(lValue), .number(rValue)): return .number(lValue - rValue) case let (.datetime(lValue), .datetime(rValue)): @@ -74,7 +82,11 @@ extension CalcExpression.Value { static func *(lhs: Self, rhs: Self) throws -> Self { switch (lhs, rhs) { case let (.integer(lValue), .integer(rValue)): - return .integer(lValue * rValue) + if case let (result, overflow) = lValue.multipliedReportingOverflow(by: rValue), !overflow { + return .integer(result) + } else { + throw CalcExpression.Value.integerOverflow() + } case let (.number(lValue), .number(rValue)): return .number(lValue * rValue) case let (.datetime(lValue), .datetime(rValue)): diff --git a/DivKit/Expressions/ExpressionLink.swift b/DivKit/Expressions/ExpressionLink.swift index f1378c4f..027d100f 100644 --- a/DivKit/Expressions/ExpressionLink.swift +++ b/DivKit/Expressions/ExpressionLink.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public struct ExpressionLink { enum Item { diff --git a/DivKit/Expressions/ExpressionResolver.swift b/DivKit/Expressions/ExpressionResolver.swift index c248381b..ba6c5cfd 100644 --- a/DivKit/Expressions/ExpressionResolver.swift +++ b/DivKit/Expressions/ExpressionResolver.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public typealias ExpressionValueValidator = (T) -> Bool diff --git a/DivKit/Expressions/Functions/CastFunctions.swift b/DivKit/Expressions/Functions/CastFunctions.swift index efb2cc16..754ffab2 100644 --- a/DivKit/Expressions/Functions/CastFunctions.swift +++ b/DivKit/Expressions/Functions/CastFunctions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic enum CastFunctions: String, CaseIterable { case toBoolean diff --git a/DivKit/Expressions/Functions/ColorFunctions.swift b/DivKit/Expressions/Functions/ColorFunctions.swift index 41470a8d..b2dd25af 100644 --- a/DivKit/Expressions/Functions/ColorFunctions.swift +++ b/DivKit/Expressions/Functions/ColorFunctions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic enum ColorFunctions: CaseIterable { enum Error { diff --git a/DivKit/Expressions/Functions/DatetimeFunctions.swift b/DivKit/Expressions/Functions/DatetimeFunctions.swift index 3a7e2c1d..5d689f2d 100644 --- a/DivKit/Expressions/Functions/DatetimeFunctions.swift +++ b/DivKit/Expressions/Functions/DatetimeFunctions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic enum DatetimeFunctions: String, CaseIterable { enum Error { diff --git a/DivKit/Expressions/Functions/Function.swift b/DivKit/Expressions/Functions/Function.swift index 0c2aa0e6..7b547252 100644 --- a/DivKit/Expressions/Functions/Function.swift +++ b/DivKit/Expressions/Functions/Function.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic protocol Function { var arity: CalcExpression.Arity { get } diff --git a/DivKit/Expressions/Functions/MathFunctions.swift b/DivKit/Expressions/Functions/MathFunctions.swift index 5ef62d4f..739bba53 100644 --- a/DivKit/Expressions/Functions/MathFunctions.swift +++ b/DivKit/Expressions/Functions/MathFunctions.swift @@ -142,7 +142,13 @@ private func _modDouble(lhs: Double, rhs: Double) throws -> Double { } private func _mulInt(args: [Int]) throws -> Int { - args.reduce(1) { $0 * $1 } + try args.reduce(1) { + if case let (result, overflow) = $0.multipliedReportingOverflow(by: $1), !overflow { + return result + } else { + throw CalcExpression.Value.integerOverflow() + } + } } private func _mulDouble(args: [Double]) throws -> Double { @@ -150,7 +156,13 @@ private func _mulDouble(args: [Double]) throws -> Double { } private func _subInt(args: [Int]) throws -> Int { - args.dropFirst().reduce(args[0]) { $0 - $1 } + try args.dropFirst().reduce(args[0]) { + if case let (result, overflow) = $0.subtractingReportingOverflow($1), !overflow { + return result + } else { + throw CalcExpression.Value.integerOverflow() + } + } } private func _subDouble(args: [Double]) throws -> Double { @@ -158,7 +170,13 @@ private func _subDouble(args: [Double]) throws -> Double { } private func _sumInt(args: [Int]) throws -> Int { - args.reduce(0) { $0 + $1 } + try args.reduce(0) { + if case let (result, overflow) = $0.addingReportingOverflow($1), !overflow { + return result + } else { + throw CalcExpression.Value.integerOverflow() + } + } } private func _sumDouble(args: [Double]) throws -> Double { @@ -166,11 +184,11 @@ private func _sumDouble(args: [Double]) throws -> Double { } private func _maxInteger() -> Int { - Int(Int32.max) + Int.max } private func _minInteger() -> Int { - Int(Int32.min) + Int.min } private func _maxNumber() -> Double { @@ -197,8 +215,11 @@ private func _minDouble(args: [Double]) -> Double { args.reduce(args[0]) { min($0, $1) } } -private func _absInt(value: Int) -> Int { - abs(value) +private func _absInt(value: Int) throws -> Int { + guard value >= -Int.max else { + throw CalcExpression.Value.integerOverflow() + } + return abs(value) } private func _absDouble(value: Double) -> Double { @@ -225,7 +246,10 @@ private func _ceil(value: Double) -> Double { ceil(value) } -private func _copySignInt(lhs: Int, rhs: Int) -> Int { +private func _copySignInt(lhs: Int, rhs: Int) throws -> Int { + guard lhs >= -Int.max && rhs >= 0 || lhs >= Int.min && rhs < 0 else { + throw CalcExpression.Value.integerOverflow() + } guard rhs != 0 else { return lhs } diff --git a/DivKit/Expressions/Serialization/DictionaryExtensions.swift b/DivKit/Expressions/Serialization/DictionaryExtensions.swift index 16e35a1c..75c4c3c9 100644 --- a/DivKit/Expressions/Serialization/DictionaryExtensions.swift +++ b/DivKit/Expressions/Serialization/DictionaryExtensions.swift @@ -1,5 +1,6 @@ import Foundation +import BasePublic import Serialization import TemplatesSupport @@ -10,7 +11,7 @@ extension Dictionary where Key == String, Value == Any { Field.makeOptional( valueGetter: (try? getOptionalField( key, - transform: { expressionTransform($0, transform: { $0 }) } + transform: { expressionTransform($0, transform: { safeCFCast($0 as CFTypeRef) }) } )).flatMap { $0 }, linkGetter: link(for: key) ) diff --git a/DivKit/Expressions/Serialization/Expression+Helpers.swift b/DivKit/Expressions/Serialization/Expression+Helpers.swift index dc768f9d..15129a71 100644 --- a/DivKit/Expressions/Serialization/Expression+Helpers.swift +++ b/DivKit/Expressions/Serialization/Expression+Helpers.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import Serialization @inlinable diff --git a/DivKit/Expressions/Serialization/Expression+ValidSerializationValue.swift b/DivKit/Expressions/Serialization/Expression+ValidSerializationValue.swift index 7fbf7157..c1ad90a2 100644 --- a/DivKit/Expressions/Serialization/Expression+ValidSerializationValue.swift +++ b/DivKit/Expressions/Serialization/Expression+ValidSerializationValue.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import Serialization extension Expression where T == Bool { diff --git a/DivKit/Expressions/Serialization/FieldExtensions.swift b/DivKit/Expressions/Serialization/FieldExtensions.swift index 6bf1ff03..be78ca5c 100644 --- a/DivKit/Expressions/Serialization/FieldExtensions.swift +++ b/DivKit/Expressions/Serialization/FieldExtensions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import Serialization import TemplatesSupport diff --git a/DivKit/Extensions/ArrayExtensions.swift b/DivKit/Extensions/ArrayExtensions.swift index 3cbbc5ff..ae6467b6 100644 --- a/DivKit/Extensions/ArrayExtensions.swift +++ b/DivKit/Extensions/ArrayExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit extension Array where Element == Div { diff --git a/DivKit/Extensions/DivAbsoluteEdgeInsetsExtensions.swift b/DivKit/Extensions/DivAbsoluteEdgeInsetsExtensions.swift index 9354356c..884b3d10 100644 --- a/DivKit/Extensions/DivAbsoluteEdgeInsetsExtensions.swift +++ b/DivKit/Extensions/DivAbsoluteEdgeInsetsExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension DivAbsoluteEdgeInsets { func makeEdgeInsets(with expressionResolver: ExpressionResolver) -> EdgeInsets { diff --git a/DivKit/Extensions/DivAccessibilityExtensions.swift b/DivKit/Extensions/DivAccessibilityExtensions.swift index d7b9fc8a..75be69b0 100644 --- a/DivKit/Extensions/DivAccessibilityExtensions.swift +++ b/DivKit/Extensions/DivAccessibilityExtensions.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic extension DivAccessibility { func accessibilityElement( diff --git a/DivKit/Extensions/DivActionBase.swift b/DivKit/Extensions/DivActionBase.swift index e63a4689..ad61278a 100644 --- a/DivKit/Extensions/DivActionBase.swift +++ b/DivKit/Extensions/DivActionBase.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit import Serialization diff --git a/DivKit/Extensions/DivActionExtensions.swift b/DivKit/Extensions/DivActionExtensions.swift index b3a6afa9..a123ddb8 100644 --- a/DivKit/Extensions/DivActionExtensions.swift +++ b/DivKit/Extensions/DivActionExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit protocol ActionHolder { diff --git a/DivKit/Extensions/DivAnimationExtensions.swift b/DivKit/Extensions/DivAnimationExtensions.swift index 34d19573..ba1bb0e3 100644 --- a/DivKit/Extensions/DivAnimationExtensions.swift +++ b/DivKit/Extensions/DivAnimationExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit extension DivAnimation { diff --git a/DivKit/Extensions/DivAppearanceTransitionExtensions.swift b/DivKit/Extensions/DivAppearanceTransitionExtensions.swift index 5158f1f2..72a49916 100644 --- a/DivKit/Extensions/DivAppearanceTransitionExtensions.swift +++ b/DivKit/Extensions/DivAppearanceTransitionExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit extension DivAppearanceTransition { diff --git a/DivKit/Extensions/DivBackgroundExtensions.swift b/DivKit/Extensions/DivBackgroundExtensions.swift index a15acf61..c54b4f10 100644 --- a/DivKit/Extensions/DivBackgroundExtensions.swift +++ b/DivKit/Extensions/DivBackgroundExtensions.swift @@ -1,10 +1,10 @@ import CoreGraphics import Foundation -import Base -import BaseUI +import BasePublic +import BaseUIPublic import LayoutKit -import Networking +import NetworkingPublic extension DivBackground { func makeBlockBackground( diff --git a/DivKit/Extensions/DivBase/DivBaseExtensions.swift b/DivKit/Extensions/DivBase/DivBaseExtensions.swift index 81e8eb5e..c84ae009 100644 --- a/DivKit/Extensions/DivBase/DivBaseExtensions.swift +++ b/DivKit/Extensions/DivBase/DivBaseExtensions.swift @@ -1,9 +1,9 @@ import CoreGraphics -import Base -import BaseUI +import BasePublic +import BaseUIPublic import LayoutKit -import Networking +import NetworkingPublic extension DivBase { func applyBaseProperties( diff --git a/DivKit/Extensions/DivChangeTransitionExtensions.swift b/DivKit/Extensions/DivChangeTransitionExtensions.swift index a0c43760..62efb672 100644 --- a/DivKit/Extensions/DivChangeTransitionExtensions.swift +++ b/DivKit/Extensions/DivChangeTransitionExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit extension DivChangeTransition { diff --git a/DivKit/Extensions/DivContainerExtensions.swift b/DivKit/Extensions/DivContainerExtensions.swift index 68de6db8..7907ff39 100644 --- a/DivKit/Extensions/DivContainerExtensions.swift +++ b/DivKit/Extensions/DivContainerExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivContainer: DivBlockModeling { diff --git a/DivKit/Extensions/DivCustom/DivCustomExtensions.swift b/DivKit/Extensions/DivCustom/DivCustomExtensions.swift index 07d47b8a..bb9920b8 100644 --- a/DivKit/Extensions/DivCustom/DivCustomExtensions.swift +++ b/DivKit/Extensions/DivCustom/DivCustomExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivCustom: DivBlockModeling { diff --git a/DivKit/Extensions/DivData/DivDataExtensions.swift b/DivKit/Extensions/DivData/DivDataExtensions.swift index 76c994c4..e6aa65f3 100644 --- a/DivKit/Extensions/DivData/DivDataExtensions.swift +++ b/DivKit/Extensions/DivData/DivDataExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit import Serialization import TemplatesSupport diff --git a/DivKit/Extensions/DivData/DivDataPatchExtensions.swift b/DivKit/Extensions/DivData/DivDataPatchExtensions.swift index 24e3e3a8..8099f5e3 100644 --- a/DivKit/Extensions/DivData/DivDataPatchExtensions.swift +++ b/DivKit/Extensions/DivData/DivDataPatchExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic extension DivData { public func applyPatch(_ patch: DivPatch) -> DivData { diff --git a/DivKit/Extensions/DivDrawable/DivDrawableExtensions.swift b/DivKit/Extensions/DivDrawable/DivDrawableExtensions.swift index 4f8a1f1d..950abb22 100644 --- a/DivKit/Extensions/DivDrawable/DivDrawableExtensions.swift +++ b/DivKit/Extensions/DivDrawable/DivDrawableExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivDrawable { diff --git a/DivKit/Extensions/DivDrawable/DivShapeExtensions.swift b/DivKit/Extensions/DivDrawable/DivShapeExtensions.swift index c93481a0..c291114b 100644 --- a/DivKit/Extensions/DivDrawable/DivShapeExtensions.swift +++ b/DivKit/Extensions/DivDrawable/DivShapeExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivShapeDrawable { diff --git a/DivKit/Extensions/DivEdgeInsetsExtensions.swift b/DivKit/Extensions/DivEdgeInsetsExtensions.swift index 575e66cb..9c567682 100644 --- a/DivKit/Extensions/DivEdgeInsetsExtensions.swift +++ b/DivKit/Extensions/DivEdgeInsetsExtensions.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivEdgeInsets { diff --git a/DivKit/Extensions/DivFilterExtensions.swift b/DivKit/Extensions/DivFilterExtensions.swift index b7102741..3c732953 100644 --- a/DivKit/Extensions/DivFilterExtensions.swift +++ b/DivKit/Extensions/DivFilterExtensions.swift @@ -1,4 +1,4 @@ -import Base +import BasePublic import CoreGraphics extension DivFilter { diff --git a/DivKit/Extensions/DivFontWeightExtensions.swift b/DivKit/Extensions/DivFontWeightExtensions.swift index 4ac4019c..4899b610 100644 --- a/DivKit/Extensions/DivFontWeightExtensions.swift +++ b/DivKit/Extensions/DivFontWeightExtensions.swift @@ -1,4 +1,4 @@ -import BaseUI +import BaseUIPublic extension DivFontWeight { var fontWeight: FontWeight { diff --git a/DivKit/Extensions/DivGalleryExtensions.swift b/DivKit/Extensions/DivGalleryExtensions.swift index e2a4000e..eeb9d552 100644 --- a/DivKit/Extensions/DivGalleryExtensions.swift +++ b/DivKit/Extensions/DivGalleryExtensions.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivGallery: DivBlockModeling, DivGalleryProtocol { @@ -66,12 +66,13 @@ extension DivGallery: DivBlockModeling, DivGalleryProtocol { } else { index = CGFloat(resolveDefaultItem(context.expressionResolver)) if index == 0 { - return .default + return GalleryViewState(contentOffset: 0, itemsCount: itemsCount) } } let newState = GalleryViewState( - contentPageIndex: index.clamp(0.0...CGFloat(itemsCount - 1)) + contentPageIndex: index.clamp(0.0...CGFloat(itemsCount - 1)), + itemsCount: itemsCount ) context.blockStateStorage.setState(path: path, state: newState) return newState diff --git a/DivKit/Extensions/DivGalleryProtocol.swift b/DivKit/Extensions/DivGalleryProtocol.swift index 9de9e816..7dd0d458 100644 --- a/DivKit/Extensions/DivGalleryProtocol.swift +++ b/DivKit/Extensions/DivGalleryProtocol.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit protocol DivGalleryProtocol: DivBase { diff --git a/DivKit/Extensions/DivGridExtensions.swift b/DivKit/Extensions/DivGridExtensions.swift index 67b2398d..8f1bb56e 100644 --- a/DivKit/Extensions/DivGridExtensions.swift +++ b/DivKit/Extensions/DivGridExtensions.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKit extension DivGrid: DivBlockModeling { diff --git a/DivKit/Extensions/DivImage/DivGifImageExtensions.swift b/DivKit/Extensions/DivImage/DivGifImageExtensions.swift index c0e44637..9dc468af 100644 --- a/DivKit/Extensions/DivImage/DivGifImageExtensions.swift +++ b/DivKit/Extensions/DivImage/DivGifImageExtensions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit extension DivGifImage: DivBlockModeling, DivImageProtocol { diff --git a/DivKit/Extensions/DivImage/DivImageContentMode.swift b/DivKit/Extensions/DivImage/DivImageContentMode.swift index 1342510e..f342db07 100644 --- a/DivKit/Extensions/DivImage/DivImageContentMode.swift +++ b/DivKit/Extensions/DivImage/DivImageContentMode.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic protocol DivImageContentMode { func resolveScale(_ expressionResolver: ExpressionResolver) -> DivImageScale diff --git a/DivKit/Extensions/DivImage/DivImageExtensions.swift b/DivKit/Extensions/DivImage/DivImageExtensions.swift index 267d0488..1beb1d7a 100644 --- a/DivKit/Extensions/DivImage/DivImageExtensions.swift +++ b/DivKit/Extensions/DivImage/DivImageExtensions.swift @@ -1,9 +1,9 @@ import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit -import Networking +import NetworkingPublic extension DivImage: DivBlockModeling, DivImageProtocol { public func makeBlock(context: DivBlockModelingContext) throws -> Block { diff --git a/DivKit/Extensions/DivImage/DivImageProtocol.swift b/DivKit/Extensions/DivImage/DivImageProtocol.swift index ccc08106..72db0456 100644 --- a/DivKit/Extensions/DivImage/DivImageProtocol.swift +++ b/DivKit/Extensions/DivImage/DivImageProtocol.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit protocol DivImageProtocol: DivBase, DivImageContentMode { diff --git a/DivKit/Extensions/DivIndicatorExtensions.swift b/DivKit/Extensions/DivIndicatorExtensions.swift index 5a4d19b5..8fb858a4 100644 --- a/DivKit/Extensions/DivIndicatorExtensions.swift +++ b/DivKit/Extensions/DivIndicatorExtensions.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKit extension DivIndicator: DivBlockModeling { diff --git a/DivKit/Extensions/DivInputExtensions.swift b/DivKit/Extensions/DivInputExtensions.swift index c01ebe73..ed48036c 100644 --- a/DivKit/Extensions/DivInputExtensions.swift +++ b/DivKit/Extensions/DivInputExtensions.swift @@ -2,8 +2,8 @@ import CoreFoundation import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivInput: DivBlockModeling { @@ -60,25 +60,14 @@ extension DivInput: DivBlockModeling { $0.uiAction(context: context.actionContext) } - let inputType: TextInputBlock.InputType - let multiLineMode: Bool - - if let inputMethod = inputMethod { - inputType = inputMethod.makeInputType(context.expressionResolver) - multiLineMode = inputMethod.isMultiLineMode(context.expressionResolver) - } else { - inputType = .keyboard(keyboardType.system) - multiLineMode = keyboardType == .multiLineText - } - return TextInputBlock( widthTrait: makeContentWidthTrait(with: context), heightTrait: makeContentHeightTrait(with: context), hint: hintValue.with(typo: hintTypo), textValue: textValue, textTypo: textTypo, - multiLineMode: multiLineMode, - inputType: inputType, + multiLineMode: keyboardType == .multiLineText, + keyboardType: keyboardType.system, highlightColor: highlightColor, maxVisibleLines: maxVisibleLines, selectAllOnFocus: selectAllOnFocus, @@ -104,14 +93,14 @@ extension DivAlignmentHorizontal { } extension DivInput.KeyboardType { - fileprivate var system: TextInputBlock.InputType.KeyboardType { + fileprivate var system: TextInputBlock.KeyboardType { switch self { case .singleLineText, .multiLineText: return .default case .phone: return .phonePad case .number: - return .numbersAndPunctuation + return .decimalPad case .email: return .emailAddress case .uri: @@ -119,49 +108,3 @@ extension DivInput.KeyboardType { } } } - -extension DivKeyboardInput.KeyboardType { - fileprivate var system: TextInputBlock.InputType.KeyboardType { - switch self { - case .singleLineText, .multiLineText: - return .default - case .phone: - return .phonePad - case .number: - return .numbersAndPunctuation - case .email: - return .emailAddress - case .uri: - return .URL - } - } -} - -extension DivInputMethod { - fileprivate func isMultiLineMode(_ resolver: ExpressionResolver) -> Bool { - switch self { - case let .divKeyboardInput(divKeyboardInput): - return divKeyboardInput.resolveKeyboardType(resolver) == .multiLineText - case .divSelectionInput: - return true - } - } - - fileprivate func makeInputType(_ resolver: ExpressionResolver) -> TextInputBlock.InputType { - switch self { - case let .divKeyboardInput(divKeyboardInput): - return .keyboard(divKeyboardInput.resolveKeyboardType(resolver).system) - case let .divSelectionInput(divSelectionInput): - return .selection(divSelectionInput.items.map { $0.makeSelectionItem(resolver) }) - } - } -} - -extension DivSelectionInput.Item { - fileprivate func makeSelectionItem(_ resolver: ExpressionResolver) -> TextInputBlock.InputType - .SelectionItem { - let text = resolveText(resolver) ?? "" - let value = resolveValue(resolver) ?? text - return TextInputBlock.InputType.SelectionItem(value: value, text: text) - } -} diff --git a/DivKit/Extensions/DivPagerExtensions.swift b/DivKit/Extensions/DivPagerExtensions.swift index 672d0b8a..c879819e 100644 --- a/DivKit/Extensions/DivPagerExtensions.swift +++ b/DivKit/Extensions/DivPagerExtensions.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivPager: DivBlockModeling, DivGalleryProtocol { diff --git a/DivKit/Extensions/DivSizeExtensions.swift b/DivKit/Extensions/DivSizeExtensions.swift index 726280bd..daf046ec 100644 --- a/DivKit/Extensions/DivSizeExtensions.swift +++ b/DivKit/Extensions/DivSizeExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivSize { diff --git a/DivKit/Extensions/DivSizeUnitExtensions.swift b/DivKit/Extensions/DivSizeUnitExtensions.swift index 0ffd726b..ce810676 100644 --- a/DivKit/Extensions/DivSizeUnitExtensions.swift +++ b/DivKit/Extensions/DivSizeUnitExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKit extension DivSizeUnit { diff --git a/DivKit/Extensions/DivSliderExtensions.swift b/DivKit/Extensions/DivSliderExtensions.swift index c6886765..3c9cfb78 100644 --- a/DivKit/Extensions/DivSliderExtensions.swift +++ b/DivKit/Extensions/DivSliderExtensions.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivSlider: DivBlockModeling { diff --git a/DivKit/Extensions/DivStateExtensions.swift b/DivKit/Extensions/DivStateExtensions.swift index 0108c9ec..d1a1870b 100644 --- a/DivKit/Extensions/DivStateExtensions.swift +++ b/DivKit/Extensions/DivStateExtensions.swift @@ -2,7 +2,7 @@ import CoreFoundation import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKit extension DivState: DivBlockModeling { diff --git a/DivKit/Extensions/DivTabsExtensions.swift b/DivKit/Extensions/DivTabsExtensions.swift index 2f30e8b9..88654cbc 100644 --- a/DivKit/Extensions/DivTabsExtensions.swift +++ b/DivKit/Extensions/DivTabsExtensions.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKit extension DivTabs: DivBlockModeling { diff --git a/DivKit/Extensions/DivTextExtensions.swift b/DivKit/Extensions/DivTextExtensions.swift index 036d3481..85599cf5 100644 --- a/DivKit/Extensions/DivTextExtensions.swift +++ b/DivKit/Extensions/DivTextExtensions.swift @@ -2,10 +2,10 @@ import CoreFoundation import CoreGraphics import Foundation -import Base -import BaseUI +import BasePublic +import BaseUIPublic import LayoutKit -import Networking +import NetworkingPublic extension DivText: DivBlockModeling { public func makeBlock(context: DivBlockModelingContext) throws -> Block { diff --git a/DivKit/Extensions/DivVisibilityActionExtensions.swift b/DivKit/Extensions/DivVisibilityActionExtensions.swift index 174fe75d..953fd1fc 100644 --- a/DivKit/Extensions/DivVisibilityActionExtensions.swift +++ b/DivKit/Extensions/DivVisibilityActionExtensions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit extension DivVisibilityAction { diff --git a/DivKit/Extensions/GradientExtentions.swift b/DivKit/Extensions/GradientExtentions.swift index 6c9d0dd1..b5e41a2e 100644 --- a/DivKit/Extensions/GradientExtentions.swift +++ b/DivKit/Extensions/GradientExtentions.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import Base -import BaseUI +import BasePublic +import BaseUIPublic extension Gradient.Linear { init(colors: [Color], angle: Int) { diff --git a/DivKit/Extensions/RelativeValueExtensions.swift b/DivKit/Extensions/RelativeValueExtensions.swift index 733bce26..c0f9fe3e 100644 --- a/DivKit/Extensions/RelativeValueExtensions.swift +++ b/DivKit/Extensions/RelativeValueExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension RelativeValue { init(double: Double) { diff --git a/DivKit/Patches/DivPatchDownloader.swift b/DivKit/Patches/DivPatchDownloader.swift index 87398a54..f624cc62 100644 --- a/DivKit/Patches/DivPatchDownloader.swift +++ b/DivKit/Patches/DivPatchDownloader.swift @@ -1,6 +1,6 @@ import Foundation -import Networking +import NetworkingPublic public class DivPatchDownloader: DivPatchProvider { private let requestPerformer: URLRequestPerforming diff --git a/DivKit/Patches/DivPatchProvider.swift b/DivKit/Patches/DivPatchProvider.swift index 80d460d2..f3cc8999 100644 --- a/DivKit/Patches/DivPatchProvider.swift +++ b/DivKit/Patches/DivPatchProvider.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public protocol DivPatchProvider { func getPatch( diff --git a/DivKit/RunLoopCardUpdateAggregator.swift b/DivKit/RunLoopCardUpdateAggregator.swift index 9fc5d198..6ee4bec6 100644 --- a/DivKit/RunLoopCardUpdateAggregator.swift +++ b/DivKit/RunLoopCardUpdateAggregator.swift @@ -1,6 +1,6 @@ import Foundation -import BaseTiny -import Base +import BaseTinyPublic +import BasePublic final class RunLoopCardUpdateAggregator { private var enabled: Bool = true diff --git a/DivKit/States/DivStateInterceptor.swift b/DivKit/States/DivStateInterceptor.swift index 8a15fcd7..faa487b6 100644 --- a/DivKit/States/DivStateInterceptor.swift +++ b/DivKit/States/DivStateInterceptor.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public protocol DivStateInterceptor { var id: String { get } diff --git a/DivKit/States/DivStateManager.swift b/DivKit/States/DivStateManager.swift index d9826778..190d01f0 100644 --- a/DivKit/States/DivStateManager.swift +++ b/DivKit/States/DivStateManager.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public class DivStateManager { public struct Item: Equatable { diff --git a/DivKit/Templates/DivTemplates.swift b/DivKit/Templates/DivTemplates.swift index 5274696a..9a77ea0f 100644 --- a/DivKit/Templates/DivTemplates.swift +++ b/DivKit/Templates/DivTemplates.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import Serialization import TemplatesSupport diff --git a/DivKit/Timers/DivTimerController.swift b/DivKit/Timers/DivTimerController.swift index 91140001..4ef4b2a7 100644 --- a/DivKit/Timers/DivTimerController.swift +++ b/DivKit/Timers/DivTimerController.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic final class DivTimerController { typealias RunActions = ([DivAction]) -> Void diff --git a/DivKit/Timers/DivTimerStrorage.swift b/DivKit/Timers/DivTimerStrorage.swift index e6fbf8ee..16d06920 100644 --- a/DivKit/Timers/DivTimerStrorage.swift +++ b/DivKit/Timers/DivTimerStrorage.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import LayoutKit final class DivTimerStorage { diff --git a/DivKit/Variables/DivTriggersStorage.swift b/DivKit/Variables/DivTriggersStorage.swift index b82fea42..68d81a7a 100644 --- a/DivKit/Variables/DivTriggersStorage.swift +++ b/DivKit/Variables/DivTriggersStorage.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import LayoutKit public typealias DivCardsTriggers = [DivCardID: [DivTrigger]] @@ -22,15 +22,15 @@ public final class DivTriggersStorage { self.variablesStorage = variablesStorage self.actionHandler = actionHandler self.urlOpener = urlOpener - variablesStorage.changeEvents.addObserver { [unowned self] event in + variablesStorage.addObserver { [unowned self] event in let cardIdTriggersPairs = makeCardIdTriggersPairsForEvent(event) cardIdTriggersPairs.forEach { (cardId, triggers) in tryRunTriggerActions( triggers: triggers, cardId: cardId, changesVariablesNames: event.kind.names, - newVariables: event.variables.new.makeVariables(for: cardId), - oldVariables: event.variables.old.makeVariables(for: cardId) + newVariables: event.newValues.makeVariables(for: cardId), + oldVariables: event.oldValues.makeVariables(for: cardId) ) } }.dispose(in: autodisposePool) diff --git a/DivKit/Variables/DivVariablesStorage.swift b/DivKit/Variables/DivVariablesStorage.swift index 262c7634..6575fde1 100644 --- a/DivKit/Variables/DivVariablesStorage.swift +++ b/DivKit/Variables/DivVariablesStorage.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public enum DivVariableNameTag {} public typealias DivVariableName = Tagged @@ -36,9 +36,9 @@ public enum DivVariableValue: Equatable { public typealias DivVariables = [DivVariableName: DivVariableValue] public final class DivVariablesStorage { - public struct Variables { - var global: DivVariables = [:] - var local: [DivCardID: DivVariables] = [:] + public struct Values { + public internal(set) var global: DivVariables = [:] + public internal(set) var local: [DivCardID: DivVariables] = [:] func makeVariables(for cardId: DivCardID) -> DivVariables { global + (local[cardId] ?? [:]) @@ -52,25 +52,14 @@ public final class DivVariablesStorage { case global(Set) } - public struct VariablesValues { - public let old: Variables - public let new: Variables - - init( - old: Variables, - new: Variables - ) { - self.old = old - self.new = new - } - } - public let kind: Kind - public let variables: VariablesValues + public let oldValues: Values + public let newValues: Values - init(kind: Kind, variables: VariablesValues) { + init(kind: Kind, oldValues: Values, newValues: Values) { self.kind = kind - self.variables = variables + self.oldValues = oldValues + self.newValues = newValues } } @@ -79,7 +68,7 @@ public final class DivVariablesStorage { changeEventsPipe.signal } - private var storage = Variables() + private var storage = Values() private let rwLock = RWLock() public init() {} @@ -96,19 +85,20 @@ public final class DivVariablesStorage { cardId: DivCardID, variables: DivVariables ) { - let oldVariables = storage + let oldValues = storage rwLock.write { storage.local[cardId] = variables } let changedVariables = makeChangedVariables( - old: rwLock.read { oldVariables.local[cardId] ?? [:] }, + old: rwLock.read { oldValues.local[cardId] ?? [:] }, new: variables ) if changedVariables.isEmpty { return } - update(with: ChangeEvent( + update(ChangeEvent( kind: .local(cardId, changedVariables), - variables: ChangeEvent.VariablesValues(old: oldVariables, new: storage) + oldValues: oldValues, + newValues: storage )) } @@ -128,14 +118,15 @@ public final class DivVariablesStorage { variables: DivVariables, triggerUpdate: Bool ) { - let oldVariables = storage + let oldValues = storage storage.global = variables if triggerUpdate { - let changedVariables = makeChangedVariables(old: oldVariables.global, new: variables) + let changedVariables = makeChangedVariables(old: oldValues.global, new: variables) if changedVariables.isEmpty { return } - update(with: ChangeEvent( + update(ChangeEvent( kind: .global(changedVariables), - variables: ChangeEvent.VariablesValues(old: oldVariables, new: storage) + oldValues: oldValues, + newValues: storage )) } } @@ -155,11 +146,15 @@ public final class DivVariablesStorage { public func reset() { rwLock.write { - storage = Variables() + storage = Values() } } - private func update(with event: ChangeEvent) { + public func addObserver(_ action: @escaping (ChangeEvent) -> Void) -> Disposable { + changeEvents.addObserver(action) + } + + private func update(_ event: ChangeEvent) { onMainThread { [weak self] in self?.changeEventsPipe.send(event) } @@ -188,23 +183,25 @@ extension DivVariablesStorage: DivVariableUpdater { rwLock.write { var cardVariables = storage.local[cardId] if let localValue = cardVariables?[name] { - let oldStorage = storage + let oldValues = storage let isUpdated = cardVariables? .update(name: name, oldValue: localValue, value: value) ?? false storage.local[cardId] = cardVariables if isUpdated { - update(with: ChangeEvent( + update(ChangeEvent( kind: .local(cardId, [name]), - variables: ChangeEvent.VariablesValues(old: oldStorage, new: storage) + oldValues: oldValues, + newValues: storage )) } } else if let globalValue = storage.global[name] { - let oldVariables = storage + let oldValues = storage let isUpdated = storage.global.update(name: name, oldValue: globalValue, value: value) if isUpdated { - update(with: ChangeEvent( + update(ChangeEvent( kind: .global([name]), - variables: ChangeEvent.VariablesValues(old: oldVariables, new: storage) + oldValues: oldValues, + newValues: storage )) } } else { diff --git a/DivKit/generated_sources/BooleanVariable.swift b/DivKit/generated_sources/BooleanVariable.swift index 2c31db26..ff23ee27 100644 --- a/DivKit/generated_sources/BooleanVariable.swift +++ b/DivKit/generated_sources/BooleanVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/BooleanVariableTemplate.swift b/DivKit/generated_sources/BooleanVariableTemplate.swift index cd193290..6a1eb0fa 100644 --- a/DivKit/generated_sources/BooleanVariableTemplate.swift +++ b/DivKit/generated_sources/BooleanVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/ColorVariable.swift b/DivKit/generated_sources/ColorVariable.swift index 98537edd..24aa876f 100644 --- a/DivKit/generated_sources/ColorVariable.swift +++ b/DivKit/generated_sources/ColorVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/ColorVariableTemplate.swift b/DivKit/generated_sources/ColorVariableTemplate.swift index 1ecaaa7f..3c763aa8 100644 --- a/DivKit/generated_sources/ColorVariableTemplate.swift +++ b/DivKit/generated_sources/ColorVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/Div.swift b/DivKit/generated_sources/Div.swift index 12dcf6ae..e9da74b2 100644 --- a/DivKit/generated_sources/Div.swift +++ b/DivKit/generated_sources/Div.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAbsoluteEdgeInsets.swift b/DivKit/generated_sources/DivAbsoluteEdgeInsets.swift index 6ba9bcb6..173571a3 100644 --- a/DivKit/generated_sources/DivAbsoluteEdgeInsets.swift +++ b/DivKit/generated_sources/DivAbsoluteEdgeInsets.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAbsoluteEdgeInsetsTemplate.swift b/DivKit/generated_sources/DivAbsoluteEdgeInsetsTemplate.swift index 499163ac..294dcc61 100644 --- a/DivKit/generated_sources/DivAbsoluteEdgeInsetsTemplate.swift +++ b/DivKit/generated_sources/DivAbsoluteEdgeInsetsTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAccessibility.swift b/DivKit/generated_sources/DivAccessibility.swift index bc887864..7e0cf516 100644 --- a/DivKit/generated_sources/DivAccessibility.swift +++ b/DivKit/generated_sources/DivAccessibility.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAccessibilityTemplate.swift b/DivKit/generated_sources/DivAccessibilityTemplate.swift index ba89201a..3429c7c3 100644 --- a/DivKit/generated_sources/DivAccessibilityTemplate.swift +++ b/DivKit/generated_sources/DivAccessibilityTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAction.swift b/DivKit/generated_sources/DivAction.swift index ddb5efdb..29e9ad3b 100644 --- a/DivKit/generated_sources/DivAction.swift +++ b/DivKit/generated_sources/DivAction.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivActionTemplate.swift b/DivKit/generated_sources/DivActionTemplate.swift index 9a277619..96814a9a 100644 --- a/DivKit/generated_sources/DivActionTemplate.swift +++ b/DivKit/generated_sources/DivActionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAlignmentHorizontal.swift b/DivKit/generated_sources/DivAlignmentHorizontal.swift index 74ca26d1..7e5130ee 100644 --- a/DivKit/generated_sources/DivAlignmentHorizontal.swift +++ b/DivKit/generated_sources/DivAlignmentHorizontal.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAlignmentVertical.swift b/DivKit/generated_sources/DivAlignmentVertical.swift index 6330baec..c7b09b26 100644 --- a/DivKit/generated_sources/DivAlignmentVertical.swift +++ b/DivKit/generated_sources/DivAlignmentVertical.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAnimation.swift b/DivKit/generated_sources/DivAnimation.swift index 3bcf6680..e4b77831 100644 --- a/DivKit/generated_sources/DivAnimation.swift +++ b/DivKit/generated_sources/DivAnimation.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAnimationInterpolator.swift b/DivKit/generated_sources/DivAnimationInterpolator.swift index 2934a784..bb95cda1 100644 --- a/DivKit/generated_sources/DivAnimationInterpolator.swift +++ b/DivKit/generated_sources/DivAnimationInterpolator.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAnimationTemplate.swift b/DivKit/generated_sources/DivAnimationTemplate.swift index 5f48c26c..c5139e2f 100644 --- a/DivKit/generated_sources/DivAnimationTemplate.swift +++ b/DivKit/generated_sources/DivAnimationTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAppearanceSetTransition.swift b/DivKit/generated_sources/DivAppearanceSetTransition.swift index a4ae8faa..3f40daef 100644 --- a/DivKit/generated_sources/DivAppearanceSetTransition.swift +++ b/DivKit/generated_sources/DivAppearanceSetTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAppearanceSetTransitionTemplate.swift b/DivKit/generated_sources/DivAppearanceSetTransitionTemplate.swift index 59c97637..77afc449 100644 --- a/DivKit/generated_sources/DivAppearanceSetTransitionTemplate.swift +++ b/DivKit/generated_sources/DivAppearanceSetTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAppearanceTransition.swift b/DivKit/generated_sources/DivAppearanceTransition.swift index 4446eb98..e7496ea3 100644 --- a/DivKit/generated_sources/DivAppearanceTransition.swift +++ b/DivKit/generated_sources/DivAppearanceTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAppearanceTransitionTemplate.swift b/DivKit/generated_sources/DivAppearanceTransitionTemplate.swift index b5bb1a4d..de2b93ae 100644 --- a/DivKit/generated_sources/DivAppearanceTransitionTemplate.swift +++ b/DivKit/generated_sources/DivAppearanceTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAspect.swift b/DivKit/generated_sources/DivAspect.swift index 76160b84..24652df2 100644 --- a/DivKit/generated_sources/DivAspect.swift +++ b/DivKit/generated_sources/DivAspect.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivAspectTemplate.swift b/DivKit/generated_sources/DivAspectTemplate.swift index 2ac9de09..0e55814f 100644 --- a/DivKit/generated_sources/DivAspectTemplate.swift +++ b/DivKit/generated_sources/DivAspectTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBackground.swift b/DivKit/generated_sources/DivBackground.swift index 4e431c45..f5c0d41f 100644 --- a/DivKit/generated_sources/DivBackground.swift +++ b/DivKit/generated_sources/DivBackground.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBackgroundTemplate.swift b/DivKit/generated_sources/DivBackgroundTemplate.swift index 74e77f5c..2ec7f3e6 100644 --- a/DivKit/generated_sources/DivBackgroundTemplate.swift +++ b/DivKit/generated_sources/DivBackgroundTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBase.swift b/DivKit/generated_sources/DivBase.swift index f41baabe..4d64e50a 100644 --- a/DivKit/generated_sources/DivBase.swift +++ b/DivKit/generated_sources/DivBase.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBlendMode.swift b/DivKit/generated_sources/DivBlendMode.swift index aded30e1..a35aa581 100644 --- a/DivKit/generated_sources/DivBlendMode.swift +++ b/DivKit/generated_sources/DivBlendMode.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBlur.swift b/DivKit/generated_sources/DivBlur.swift index 81926965..0fc8acb9 100644 --- a/DivKit/generated_sources/DivBlur.swift +++ b/DivKit/generated_sources/DivBlur.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBlurTemplate.swift b/DivKit/generated_sources/DivBlurTemplate.swift index 4b9b463b..401faff7 100644 --- a/DivKit/generated_sources/DivBlurTemplate.swift +++ b/DivKit/generated_sources/DivBlurTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBorder.swift b/DivKit/generated_sources/DivBorder.swift index 3fec16ff..3ac98036 100644 --- a/DivKit/generated_sources/DivBorder.swift +++ b/DivKit/generated_sources/DivBorder.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivBorderTemplate.swift b/DivKit/generated_sources/DivBorderTemplate.swift index 96f46f54..e4d5ce4b 100644 --- a/DivKit/generated_sources/DivBorderTemplate.swift +++ b/DivKit/generated_sources/DivBorderTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeBoundsTransition.swift b/DivKit/generated_sources/DivChangeBoundsTransition.swift index f94d9e85..672545ca 100644 --- a/DivKit/generated_sources/DivChangeBoundsTransition.swift +++ b/DivKit/generated_sources/DivChangeBoundsTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeBoundsTransitionTemplate.swift b/DivKit/generated_sources/DivChangeBoundsTransitionTemplate.swift index dd754670..6f5e9ab3 100644 --- a/DivKit/generated_sources/DivChangeBoundsTransitionTemplate.swift +++ b/DivKit/generated_sources/DivChangeBoundsTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeSetTransition.swift b/DivKit/generated_sources/DivChangeSetTransition.swift index bad39029..cacb43b5 100644 --- a/DivKit/generated_sources/DivChangeSetTransition.swift +++ b/DivKit/generated_sources/DivChangeSetTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeSetTransitionTemplate.swift b/DivKit/generated_sources/DivChangeSetTransitionTemplate.swift index 41f374f8..394fc41e 100644 --- a/DivKit/generated_sources/DivChangeSetTransitionTemplate.swift +++ b/DivKit/generated_sources/DivChangeSetTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeTransition.swift b/DivKit/generated_sources/DivChangeTransition.swift index 1e3a8379..27c5b6e9 100644 --- a/DivKit/generated_sources/DivChangeTransition.swift +++ b/DivKit/generated_sources/DivChangeTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivChangeTransitionTemplate.swift b/DivKit/generated_sources/DivChangeTransitionTemplate.swift index 8303a865..15f2a372 100644 --- a/DivKit/generated_sources/DivChangeTransitionTemplate.swift +++ b/DivKit/generated_sources/DivChangeTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCircleShape.swift b/DivKit/generated_sources/DivCircleShape.swift index 98aec930..3c840d8f 100644 --- a/DivKit/generated_sources/DivCircleShape.swift +++ b/DivKit/generated_sources/DivCircleShape.swift @@ -1,37 +1,21 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport public final class DivCircleShape { public static let type: String = "circle" - public let backgroundColor: Expression? public let radius: DivFixedSize // default value: DivFixedSize(value: .value(10)) - public let stroke: DivStroke? - - public func resolveBackgroundColor(_ resolver: ExpressionResolver) -> Color? { - resolver.resolveStringBasedValue(expression: backgroundColor, initializer: Color.color(withHexString:)) - } - - static let backgroundColorValidator: AnyValueValidator = - makeNoOpValueValidator() static let radiusValidator: AnyValueValidator = makeNoOpValueValidator() - static let strokeValidator: AnyValueValidator = - makeNoOpValueValidator() - init( - backgroundColor: Expression? = nil, - radius: DivFixedSize? = nil, - stroke: DivStroke? = nil + radius: DivFixedSize? = nil ) { - self.backgroundColor = backgroundColor self.radius = radius ?? DivFixedSize(value: .value(10)) - self.stroke = stroke } } @@ -39,9 +23,7 @@ public final class DivCircleShape { extension DivCircleShape: Equatable { public static func ==(lhs: DivCircleShape, rhs: DivCircleShape) -> Bool { guard - lhs.backgroundColor == rhs.backgroundColor, - lhs.radius == rhs.radius, - lhs.stroke == rhs.stroke + lhs.radius == rhs.radius else { return false } @@ -54,9 +36,7 @@ extension DivCircleShape: Serializable { public func toDictionary() -> [String: ValidSerializationValue] { var result: [String: ValidSerializationValue] = [:] result["type"] = Self.type - result["background_color"] = backgroundColor?.toValidSerializationValue() result["radius"] = radius.toDictionary() - result["stroke"] = stroke?.toDictionary() return result } } diff --git a/DivKit/generated_sources/DivCircleShapeTemplate.swift b/DivKit/generated_sources/DivCircleShapeTemplate.swift index 81f721cd..a6669b48 100644 --- a/DivKit/generated_sources/DivCircleShapeTemplate.swift +++ b/DivKit/generated_sources/DivCircleShapeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport @@ -8,9 +8,7 @@ import TemplatesSupport public final class DivCircleShapeTemplate: TemplateValue, TemplateDeserializable { public static let type: String = "circle" public let parent: String? // at least 1 char - public let backgroundColor: Field>? public let radius: Field? // default value: DivFixedSize(value: .value(10)) - public let stroke: Field? static let parentValidator: AnyValueValidator = makeStringValidator(minLength: 1) @@ -18,37 +16,25 @@ public final class DivCircleShapeTemplate: TemplateValue, TemplateDeserializable public convenience init(dictionary: [String: Any], templateToType: TemplateToType) throws { self.init( parent: try dictionary.getOptionalField("type", validator: Self.parentValidator), - backgroundColor: try dictionary.getOptionalExpressionField("background_color", transform: Color.color(withHexString:)), - radius: try dictionary.getOptionalField("radius", templateToType: templateToType), - stroke: try dictionary.getOptionalField("stroke", templateToType: templateToType) + radius: try dictionary.getOptionalField("radius", templateToType: templateToType) ) } init( parent: String?, - backgroundColor: Field>? = nil, - radius: Field? = nil, - stroke: Field? = nil + radius: Field? = nil ) { self.parent = parent - self.backgroundColor = backgroundColor self.radius = radius - self.stroke = stroke } private static func resolveOnlyLinks(context: Context, parent: DivCircleShapeTemplate?) -> DeserializationResult { - let backgroundColorValue = parent?.backgroundColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:), validator: ResolvedValue.backgroundColorValidator) ?? .noValue let radiusValue = parent?.radius?.resolveOptionalValue(context: context, validator: ResolvedValue.radiusValidator, useOnlyLinks: true) ?? .noValue - let strokeValue = parent?.stroke?.resolveOptionalValue(context: context, validator: ResolvedValue.strokeValidator, useOnlyLinks: true) ?? .noValue let errors = mergeErrors( - backgroundColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "background_color", error: $0) }, - radiusValue.errorsOrWarnings?.map { .nestedObjectError(field: "radius", error: $0) }, - strokeValue.errorsOrWarnings?.map { .nestedObjectError(field: "stroke", error: $0) } + radiusValue.errorsOrWarnings?.map { .nestedObjectError(field: "radius", error: $0) } ) let result = DivCircleShape( - backgroundColor: backgroundColorValue.value, - radius: radiusValue.value, - stroke: strokeValue.value + radius: radiusValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } @@ -57,39 +43,24 @@ public final class DivCircleShapeTemplate: TemplateValue, TemplateDeserializable if useOnlyLinks { return resolveOnlyLinks(context: context, parent: parent) } - var backgroundColorValue: DeserializationResult> = parent?.backgroundColor?.value() ?? .noValue var radiusValue: DeserializationResult = .noValue - var strokeValue: DeserializationResult = .noValue context.templateData.forEach { key, __dictValue in switch key { - case "background_color": - backgroundColorValue = deserialize(__dictValue, transform: Color.color(withHexString:), validator: ResolvedValue.backgroundColorValidator).merged(with: backgroundColorValue) case "radius": radiusValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.radiusValidator, type: DivFixedSizeTemplate.self).merged(with: radiusValue) - case "stroke": - strokeValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.strokeValidator, type: DivStrokeTemplate.self).merged(with: strokeValue) - case parent?.backgroundColor?.link: - backgroundColorValue = backgroundColorValue.merged(with: deserialize(__dictValue, transform: Color.color(withHexString:), validator: ResolvedValue.backgroundColorValidator)) case parent?.radius?.link: radiusValue = radiusValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.radiusValidator, type: DivFixedSizeTemplate.self)) - case parent?.stroke?.link: - strokeValue = strokeValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.strokeValidator, type: DivStrokeTemplate.self)) default: break } } if let parent = parent { radiusValue = radiusValue.merged(with: parent.radius?.resolveOptionalValue(context: context, validator: ResolvedValue.radiusValidator, useOnlyLinks: true)) - strokeValue = strokeValue.merged(with: parent.stroke?.resolveOptionalValue(context: context, validator: ResolvedValue.strokeValidator, useOnlyLinks: true)) } let errors = mergeErrors( - backgroundColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "background_color", error: $0) }, - radiusValue.errorsOrWarnings?.map { .nestedObjectError(field: "radius", error: $0) }, - strokeValue.errorsOrWarnings?.map { .nestedObjectError(field: "stroke", error: $0) } + radiusValue.errorsOrWarnings?.map { .nestedObjectError(field: "radius", error: $0) } ) let result = DivCircleShape( - backgroundColor: backgroundColorValue.value, - radius: radiusValue.value, - stroke: strokeValue.value + radius: radiusValue.value ) return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) } @@ -103,9 +74,7 @@ public final class DivCircleShapeTemplate: TemplateValue, TemplateDeserializable return DivCircleShapeTemplate( parent: nil, - backgroundColor: backgroundColor ?? mergedParent.backgroundColor, - radius: radius ?? mergedParent.radius, - stroke: stroke ?? mergedParent.stroke + radius: radius ?? mergedParent.radius ) } @@ -114,9 +83,7 @@ public final class DivCircleShapeTemplate: TemplateValue, TemplateDeserializable return DivCircleShapeTemplate( parent: nil, - backgroundColor: merged.backgroundColor, - radius: merged.radius?.tryResolveParent(templates: templates), - stroke: merged.stroke?.tryResolveParent(templates: templates) + radius: merged.radius?.tryResolveParent(templates: templates) ) } } diff --git a/DivKit/generated_sources/DivContainer.swift b/DivKit/generated_sources/DivContainer.swift index aa78730f..96422c8e 100644 --- a/DivKit/generated_sources/DivContainer.swift +++ b/DivKit/generated_sources/DivContainer.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivContainerTemplate.swift b/DivKit/generated_sources/DivContainerTemplate.swift index 37e4b8ea..cff3745a 100644 --- a/DivKit/generated_sources/DivContainerTemplate.swift +++ b/DivKit/generated_sources/DivContainerTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCornersRadius.swift b/DivKit/generated_sources/DivCornersRadius.swift index e109e580..4ef18d34 100644 --- a/DivKit/generated_sources/DivCornersRadius.swift +++ b/DivKit/generated_sources/DivCornersRadius.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCornersRadiusTemplate.swift b/DivKit/generated_sources/DivCornersRadiusTemplate.swift index d80e3ef8..d75d13bf 100644 --- a/DivKit/generated_sources/DivCornersRadiusTemplate.swift +++ b/DivKit/generated_sources/DivCornersRadiusTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCount.swift b/DivKit/generated_sources/DivCount.swift index 6072f3d9..ed303c5d 100644 --- a/DivKit/generated_sources/DivCount.swift +++ b/DivKit/generated_sources/DivCount.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCountTemplate.swift b/DivKit/generated_sources/DivCountTemplate.swift index b8b13138..2edac96e 100644 --- a/DivKit/generated_sources/DivCountTemplate.swift +++ b/DivKit/generated_sources/DivCountTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCustom.swift b/DivKit/generated_sources/DivCustom.swift index 7250d0a3..93d1cd61 100644 --- a/DivKit/generated_sources/DivCustom.swift +++ b/DivKit/generated_sources/DivCustom.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivCustomTemplate.swift b/DivKit/generated_sources/DivCustomTemplate.swift index 9ca08264..ce096962 100644 --- a/DivKit/generated_sources/DivCustomTemplate.swift +++ b/DivKit/generated_sources/DivCustomTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivData.swift b/DivKit/generated_sources/DivData.swift index 072c29fd..a09af671 100644 --- a/DivKit/generated_sources/DivData.swift +++ b/DivKit/generated_sources/DivData.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDataTemplate.swift b/DivKit/generated_sources/DivDataTemplate.swift index 442d3305..ea301b16 100644 --- a/DivKit/generated_sources/DivDataTemplate.swift +++ b/DivKit/generated_sources/DivDataTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDefaultIndicatorItemPlacement.swift b/DivKit/generated_sources/DivDefaultIndicatorItemPlacement.swift index da702277..bca437c9 100644 --- a/DivKit/generated_sources/DivDefaultIndicatorItemPlacement.swift +++ b/DivKit/generated_sources/DivDefaultIndicatorItemPlacement.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDefaultIndicatorItemPlacementTemplate.swift b/DivKit/generated_sources/DivDefaultIndicatorItemPlacementTemplate.swift index 1fb25e4a..4a51b221 100644 --- a/DivKit/generated_sources/DivDefaultIndicatorItemPlacementTemplate.swift +++ b/DivKit/generated_sources/DivDefaultIndicatorItemPlacementTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDimension.swift b/DivKit/generated_sources/DivDimension.swift index 50e03e88..f2455325 100644 --- a/DivKit/generated_sources/DivDimension.swift +++ b/DivKit/generated_sources/DivDimension.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDimensionTemplate.swift b/DivKit/generated_sources/DivDimensionTemplate.swift index cb74236f..dbdd8230 100644 --- a/DivKit/generated_sources/DivDimensionTemplate.swift +++ b/DivKit/generated_sources/DivDimensionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDownloadCallbacks.swift b/DivKit/generated_sources/DivDownloadCallbacks.swift index b728b346..2c19f060 100644 --- a/DivKit/generated_sources/DivDownloadCallbacks.swift +++ b/DivKit/generated_sources/DivDownloadCallbacks.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDownloadCallbacksTemplate.swift b/DivKit/generated_sources/DivDownloadCallbacksTemplate.swift index ed2984b3..0cca1424 100644 --- a/DivKit/generated_sources/DivDownloadCallbacksTemplate.swift +++ b/DivKit/generated_sources/DivDownloadCallbacksTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDrawable.swift b/DivKit/generated_sources/DivDrawable.swift index 863d3ad6..7419369a 100644 --- a/DivKit/generated_sources/DivDrawable.swift +++ b/DivKit/generated_sources/DivDrawable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivDrawableTemplate.swift b/DivKit/generated_sources/DivDrawableTemplate.swift index 4b25720a..13bea0bb 100644 --- a/DivKit/generated_sources/DivDrawableTemplate.swift +++ b/DivKit/generated_sources/DivDrawableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivEdgeInsets.swift b/DivKit/generated_sources/DivEdgeInsets.swift index 403027e6..135cb3b7 100644 --- a/DivKit/generated_sources/DivEdgeInsets.swift +++ b/DivKit/generated_sources/DivEdgeInsets.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivEdgeInsetsTemplate.swift b/DivKit/generated_sources/DivEdgeInsetsTemplate.swift index d32a17e4..0f921d83 100644 --- a/DivKit/generated_sources/DivEdgeInsetsTemplate.swift +++ b/DivKit/generated_sources/DivEdgeInsetsTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivExtension.swift b/DivKit/generated_sources/DivExtension.swift index 01f22e59..92a17979 100644 --- a/DivKit/generated_sources/DivExtension.swift +++ b/DivKit/generated_sources/DivExtension.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivExtensionTemplate.swift b/DivKit/generated_sources/DivExtensionTemplate.swift index 4ce73288..55990918 100644 --- a/DivKit/generated_sources/DivExtensionTemplate.swift +++ b/DivKit/generated_sources/DivExtensionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFadeTransition.swift b/DivKit/generated_sources/DivFadeTransition.swift index 9aa541ea..eecf3681 100644 --- a/DivKit/generated_sources/DivFadeTransition.swift +++ b/DivKit/generated_sources/DivFadeTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFadeTransitionTemplate.swift b/DivKit/generated_sources/DivFadeTransitionTemplate.swift index 5b39f667..becfeeb1 100644 --- a/DivKit/generated_sources/DivFadeTransitionTemplate.swift +++ b/DivKit/generated_sources/DivFadeTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFilter.swift b/DivKit/generated_sources/DivFilter.swift index c8330b08..ec805ecc 100644 --- a/DivKit/generated_sources/DivFilter.swift +++ b/DivKit/generated_sources/DivFilter.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFilterTemplate.swift b/DivKit/generated_sources/DivFilterTemplate.swift index 05d64cd0..8f8ff6c3 100644 --- a/DivKit/generated_sources/DivFilterTemplate.swift +++ b/DivKit/generated_sources/DivFilterTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedCount.swift b/DivKit/generated_sources/DivFixedCount.swift index f6b3fdc0..d7e381bb 100644 --- a/DivKit/generated_sources/DivFixedCount.swift +++ b/DivKit/generated_sources/DivFixedCount.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedCountTemplate.swift b/DivKit/generated_sources/DivFixedCountTemplate.swift index df0a4ad7..44350ea4 100644 --- a/DivKit/generated_sources/DivFixedCountTemplate.swift +++ b/DivKit/generated_sources/DivFixedCountTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedLengthInputMask.swift b/DivKit/generated_sources/DivFixedLengthInputMask.swift index 6c17592c..8afc2d39 100644 --- a/DivKit/generated_sources/DivFixedLengthInputMask.swift +++ b/DivKit/generated_sources/DivFixedLengthInputMask.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedLengthInputMaskTemplate.swift b/DivKit/generated_sources/DivFixedLengthInputMaskTemplate.swift index 67f48a5d..784d0072 100644 --- a/DivKit/generated_sources/DivFixedLengthInputMaskTemplate.swift +++ b/DivKit/generated_sources/DivFixedLengthInputMaskTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedSize.swift b/DivKit/generated_sources/DivFixedSize.swift index 3d4557fb..d7b7cdb9 100644 --- a/DivKit/generated_sources/DivFixedSize.swift +++ b/DivKit/generated_sources/DivFixedSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFixedSizeTemplate.swift b/DivKit/generated_sources/DivFixedSizeTemplate.swift index a2fb08a6..aac154cb 100644 --- a/DivKit/generated_sources/DivFixedSizeTemplate.swift +++ b/DivKit/generated_sources/DivFixedSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFocus.swift b/DivKit/generated_sources/DivFocus.swift index ed83b99d..a96ae568 100644 --- a/DivKit/generated_sources/DivFocus.swift +++ b/DivKit/generated_sources/DivFocus.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFocusTemplate.swift b/DivKit/generated_sources/DivFocusTemplate.swift index eb740a6b..e0a5018c 100644 --- a/DivKit/generated_sources/DivFocusTemplate.swift +++ b/DivKit/generated_sources/DivFocusTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFontFamily.swift b/DivKit/generated_sources/DivFontFamily.swift index afab4b13..dc25707e 100644 --- a/DivKit/generated_sources/DivFontFamily.swift +++ b/DivKit/generated_sources/DivFontFamily.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivFontWeight.swift b/DivKit/generated_sources/DivFontWeight.swift index f3ab252a..667bfff3 100644 --- a/DivKit/generated_sources/DivFontWeight.swift +++ b/DivKit/generated_sources/DivFontWeight.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGallery.swift b/DivKit/generated_sources/DivGallery.swift index 776603ba..36a6e4d5 100644 --- a/DivKit/generated_sources/DivGallery.swift +++ b/DivKit/generated_sources/DivGallery.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGalleryTemplate.swift b/DivKit/generated_sources/DivGalleryTemplate.swift index dca13ccd..7e59f4ce 100644 --- a/DivKit/generated_sources/DivGalleryTemplate.swift +++ b/DivKit/generated_sources/DivGalleryTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGifImage.swift b/DivKit/generated_sources/DivGifImage.swift index f3a99412..07b32136 100644 --- a/DivKit/generated_sources/DivGifImage.swift +++ b/DivKit/generated_sources/DivGifImage.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGifImageTemplate.swift b/DivKit/generated_sources/DivGifImageTemplate.swift index 49ab7a11..2bae59b5 100644 --- a/DivKit/generated_sources/DivGifImageTemplate.swift +++ b/DivKit/generated_sources/DivGifImageTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGrid.swift b/DivKit/generated_sources/DivGrid.swift index f01fa937..0c11c8c2 100644 --- a/DivKit/generated_sources/DivGrid.swift +++ b/DivKit/generated_sources/DivGrid.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivGridTemplate.swift b/DivKit/generated_sources/DivGridTemplate.swift index 5f5dd1c8..c40b0d7f 100644 --- a/DivKit/generated_sources/DivGridTemplate.swift +++ b/DivKit/generated_sources/DivGridTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivImage.swift b/DivKit/generated_sources/DivImage.swift index 5ff60417..d0854f06 100644 --- a/DivKit/generated_sources/DivImage.swift +++ b/DivKit/generated_sources/DivImage.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivImageBackground.swift b/DivKit/generated_sources/DivImageBackground.swift index a5c740b0..e9d69ee5 100644 --- a/DivKit/generated_sources/DivImageBackground.swift +++ b/DivKit/generated_sources/DivImageBackground.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivImageBackgroundTemplate.swift b/DivKit/generated_sources/DivImageBackgroundTemplate.swift index 08391b67..05986895 100644 --- a/DivKit/generated_sources/DivImageBackgroundTemplate.swift +++ b/DivKit/generated_sources/DivImageBackgroundTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivImageScale.swift b/DivKit/generated_sources/DivImageScale.swift index 225fae81..174cb191 100644 --- a/DivKit/generated_sources/DivImageScale.swift +++ b/DivKit/generated_sources/DivImageScale.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivImageTemplate.swift b/DivKit/generated_sources/DivImageTemplate.swift index da3d279a..bad9b3e0 100644 --- a/DivKit/generated_sources/DivImageTemplate.swift +++ b/DivKit/generated_sources/DivImageTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivIndicator.swift b/DivKit/generated_sources/DivIndicator.swift index c3e4b29c..0dfb5bae 100644 --- a/DivKit/generated_sources/DivIndicator.swift +++ b/DivKit/generated_sources/DivIndicator.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivIndicatorItemPlacement.swift b/DivKit/generated_sources/DivIndicatorItemPlacement.swift index 497f30e1..7ccd95d9 100644 --- a/DivKit/generated_sources/DivIndicatorItemPlacement.swift +++ b/DivKit/generated_sources/DivIndicatorItemPlacement.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivIndicatorItemPlacementTemplate.swift b/DivKit/generated_sources/DivIndicatorItemPlacementTemplate.swift index a531d008..55d40dd1 100644 --- a/DivKit/generated_sources/DivIndicatorItemPlacementTemplate.swift +++ b/DivKit/generated_sources/DivIndicatorItemPlacementTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivIndicatorTemplate.swift b/DivKit/generated_sources/DivIndicatorTemplate.swift index 0f37c4ef..fe14bb19 100644 --- a/DivKit/generated_sources/DivIndicatorTemplate.swift +++ b/DivKit/generated_sources/DivIndicatorTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivInfinityCount.swift b/DivKit/generated_sources/DivInfinityCount.swift index c0933d1f..204a8740 100644 --- a/DivKit/generated_sources/DivInfinityCount.swift +++ b/DivKit/generated_sources/DivInfinityCount.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivInfinityCountTemplate.swift b/DivKit/generated_sources/DivInfinityCountTemplate.swift index 9dd1c518..0788a13a 100644 --- a/DivKit/generated_sources/DivInfinityCountTemplate.swift +++ b/DivKit/generated_sources/DivInfinityCountTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivInput.swift b/DivKit/generated_sources/DivInput.swift index 47bd0d28..376d134d 100644 --- a/DivKit/generated_sources/DivInput.swift +++ b/DivKit/generated_sources/DivInput.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport @@ -49,12 +49,10 @@ public final class DivInput: DivBase { public let hintColor: Expression // default value: #73000000 public let hintText: Expression? // at least 1 char public let id: String? // at least 1 char - public let inputMethod: DivInputMethod? public let keyboardType: Expression // default value: multi_line_text public let letterSpacing: Expression // default value: 0 public let lineHeight: Expression? // constraint: number >= 0 public let margins: DivEdgeInsets - public let mask: DivInputMask? public let maxVisibleLines: Expression? // constraint: number > 0 public let nativeInterface: NativeInterface? public let paddings: DivEdgeInsets @@ -204,9 +202,6 @@ public final class DivInput: DivBase { static let idValidator: AnyValueValidator = makeStringValidator(minLength: 1) - static let inputMethodValidator: AnyValueValidator = - makeNoOpValueValidator() - static let keyboardTypeValidator: AnyValueValidator = makeNoOpValueValidator() @@ -216,9 +211,6 @@ public final class DivInput: DivBase { static let marginsValidator: AnyValueValidator = makeNoOpValueValidator() - static let maskValidator: AnyValueValidator = - makeNoOpValueValidator() - static let maxVisibleLinesValidator: AnyValueValidator = makeValueValidator(valueValidator: { $0 > 0 }) @@ -292,12 +284,10 @@ public final class DivInput: DivBase { hintColor: Expression? = nil, hintText: Expression? = nil, id: String? = nil, - inputMethod: DivInputMethod? = nil, keyboardType: Expression? = nil, letterSpacing: Expression? = nil, lineHeight: Expression? = nil, margins: DivEdgeInsets? = nil, - mask: DivInputMask? = nil, maxVisibleLines: Expression? = nil, nativeInterface: NativeInterface? = nil, paddings: DivEdgeInsets? = nil, @@ -335,12 +325,10 @@ public final class DivInput: DivBase { self.hintColor = hintColor ?? .value(Color.colorWithARGBHexCode(0x73000000)) self.hintText = hintText self.id = id - self.inputMethod = inputMethod self.keyboardType = keyboardType ?? .value(.multiLineText) self.letterSpacing = letterSpacing ?? .value(0) self.lineHeight = lineHeight self.margins = margins ?? DivEdgeInsets() - self.mask = mask self.maxVisibleLines = maxVisibleLines self.nativeInterface = nativeInterface self.paddings = paddings ?? DivEdgeInsets() @@ -408,57 +396,55 @@ extension DivInput: Equatable { return false } guard - lhs.inputMethod == rhs.inputMethod, lhs.keyboardType == rhs.keyboardType, - lhs.letterSpacing == rhs.letterSpacing + lhs.letterSpacing == rhs.letterSpacing, + lhs.lineHeight == rhs.lineHeight else { return false } guard - lhs.lineHeight == rhs.lineHeight, lhs.margins == rhs.margins, - lhs.mask == rhs.mask - else { - return false - } - guard lhs.maxVisibleLines == rhs.maxVisibleLines, - lhs.nativeInterface == rhs.nativeInterface, - lhs.paddings == rhs.paddings + lhs.nativeInterface == rhs.nativeInterface else { return false } guard + lhs.paddings == rhs.paddings, lhs.rowSpan == rhs.rowSpan, - lhs.selectAllOnFocus == rhs.selectAllOnFocus, - lhs.selectedActions == rhs.selectedActions + lhs.selectAllOnFocus == rhs.selectAllOnFocus else { return false } guard + lhs.selectedActions == rhs.selectedActions, lhs.textColor == rhs.textColor, - lhs.textVariable == rhs.textVariable, - lhs.tooltips == rhs.tooltips + lhs.textVariable == rhs.textVariable else { return false } guard + lhs.tooltips == rhs.tooltips, lhs.transform == rhs.transform, - lhs.transitionChange == rhs.transitionChange, - lhs.transitionIn == rhs.transitionIn + lhs.transitionChange == rhs.transitionChange else { return false } guard + lhs.transitionIn == rhs.transitionIn, lhs.transitionOut == rhs.transitionOut, - lhs.transitionTriggers == rhs.transitionTriggers, - lhs.visibility == rhs.visibility + lhs.transitionTriggers == rhs.transitionTriggers else { return false } guard + lhs.visibility == rhs.visibility, lhs.visibilityAction == rhs.visibilityAction, - lhs.visibilityActions == rhs.visibilityActions, + lhs.visibilityActions == rhs.visibilityActions + else { + return false + } + guard lhs.width == rhs.width else { return false @@ -490,12 +476,10 @@ extension DivInput: Serializable { result["hint_color"] = hintColor.toValidSerializationValue() result["hint_text"] = hintText?.toValidSerializationValue() result["id"] = id - result["input_method"] = inputMethod?.toDictionary() result["keyboard_type"] = keyboardType.toValidSerializationValue() result["letter_spacing"] = letterSpacing.toValidSerializationValue() result["line_height"] = lineHeight?.toValidSerializationValue() result["margins"] = margins.toDictionary() - result["mask"] = mask?.toDictionary() result["max_visible_lines"] = maxVisibleLines?.toValidSerializationValue() result["native_interface"] = nativeInterface?.toDictionary() result["paddings"] = paddings.toDictionary() diff --git a/DivKit/generated_sources/DivInputMask.swift b/DivKit/generated_sources/DivInputMask.swift index fa3443fd..e649faae 100644 --- a/DivKit/generated_sources/DivInputMask.swift +++ b/DivKit/generated_sources/DivInputMask.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivInputMaskTemplate.swift b/DivKit/generated_sources/DivInputMaskTemplate.swift deleted file mode 100644 index be7bbb35..00000000 --- a/DivKit/generated_sources/DivInputMaskTemplate.swift +++ /dev/null @@ -1,78 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -@frozen -public enum DivInputMaskTemplate: TemplateValue { - case divFixedLengthInputMaskTemplate(DivFixedLengthInputMaskTemplate) - - public var value: Any { - switch self { - case let .divFixedLengthInputMaskTemplate(value): - return value - } - } - - public func resolveParent(templates: Templates) throws -> DivInputMaskTemplate { - switch self { - case let .divFixedLengthInputMaskTemplate(value): - return .divFixedLengthInputMaskTemplate(try value.resolveParent(templates: templates)) - } - } - - public static func resolveValue(context: Context, parent: DivInputMaskTemplate?, useOnlyLinks: Bool) -> DeserializationResult { - guard let parent = parent else { - if useOnlyLinks { - return .failure(NonEmptyArray(.missingType(representation: context.templateData))) - } else { - return resolveUnknownValue(context: context, useOnlyLinks: useOnlyLinks) - } - } - - switch parent { - case let .divFixedLengthInputMaskTemplate(value): - let result = value.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divFixedLengthInputMask(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divFixedLengthInputMask(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - } - } - - private static func resolveUnknownValue(context: Context, useOnlyLinks: Bool) -> DeserializationResult { - guard let type = (context.templateData["type"] as? String).flatMap({ context.templateToType[$0] ?? $0 }) else { - return .failure(NonEmptyArray(.requiredFieldIsMissing(field: "type"))) - } - - switch type { - case DivFixedLengthInputMask.type: - let result = DivFixedLengthInputMaskTemplate.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divFixedLengthInputMask(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divFixedLengthInputMask(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - default: - return .failure(NonEmptyArray(.requiredFieldIsMissing(field: "type"))) - } - } -} - -extension DivInputMaskTemplate: TemplateDeserializable { - public init(dictionary: [String: Any], templateToType: TemplateToType) throws { - let receivedType = try dictionary.getField("type") as String - let blockType = templateToType[receivedType] ?? receivedType - switch blockType { - case DivFixedLengthInputMaskTemplate.type: - self = .divFixedLengthInputMaskTemplate(try DivFixedLengthInputMaskTemplate(dictionary: dictionary, templateToType: templateToType)) - default: - throw DeserializationError.invalidFieldRepresentation(field: "div-input-mask_template", representation: dictionary) - } - } -} diff --git a/DivKit/generated_sources/DivInputMethod.swift b/DivKit/generated_sources/DivInputMethod.swift deleted file mode 100644 index e68e3f51..00000000 --- a/DivKit/generated_sources/DivInputMethod.swift +++ /dev/null @@ -1,42 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -@frozen -public enum DivInputMethod { - case divKeyboardInput(DivKeyboardInput) - case divSelectionInput(DivSelectionInput) - - public var value: Serializable { - switch self { - case let .divKeyboardInput(value): - return value - case let .divSelectionInput(value): - return value - } - } -} - -#if DEBUG -extension DivInputMethod: Equatable { - public static func ==(lhs: DivInputMethod, rhs: DivInputMethod) -> Bool { - switch (lhs, rhs) { - case let (.divKeyboardInput(l), .divKeyboardInput(r)): - return l == r - case let (.divSelectionInput(l), .divSelectionInput(r)): - return l == r - default: - return false - } - } -} -#endif - -extension DivInputMethod: Serializable { - public func toDictionary() -> [String: ValidSerializationValue] { - return value.toDictionary() - } -} diff --git a/DivKit/generated_sources/DivInputMethodTemplate.swift b/DivKit/generated_sources/DivInputMethodTemplate.swift deleted file mode 100644 index 1488f82b..00000000 --- a/DivKit/generated_sources/DivInputMethodTemplate.swift +++ /dev/null @@ -1,101 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -@frozen -public enum DivInputMethodTemplate: TemplateValue { - case divKeyboardInputTemplate(DivKeyboardInputTemplate) - case divSelectionInputTemplate(DivSelectionInputTemplate) - - public var value: Any { - switch self { - case let .divKeyboardInputTemplate(value): - return value - case let .divSelectionInputTemplate(value): - return value - } - } - - public func resolveParent(templates: Templates) throws -> DivInputMethodTemplate { - switch self { - case let .divKeyboardInputTemplate(value): - return .divKeyboardInputTemplate(try value.resolveParent(templates: templates)) - case let .divSelectionInputTemplate(value): - return .divSelectionInputTemplate(try value.resolveParent(templates: templates)) - } - } - - public static func resolveValue(context: Context, parent: DivInputMethodTemplate?, useOnlyLinks: Bool) -> DeserializationResult { - guard let parent = parent else { - if useOnlyLinks { - return .failure(NonEmptyArray(.missingType(representation: context.templateData))) - } else { - return resolveUnknownValue(context: context, useOnlyLinks: useOnlyLinks) - } - } - - switch parent { - case let .divKeyboardInputTemplate(value): - let result = value.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divKeyboardInput(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divKeyboardInput(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - case let .divSelectionInputTemplate(value): - let result = value.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divSelectionInput(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divSelectionInput(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - } - } - - private static func resolveUnknownValue(context: Context, useOnlyLinks: Bool) -> DeserializationResult { - guard let type = (context.templateData["type"] as? String).flatMap({ context.templateToType[$0] ?? $0 }) else { - return .failure(NonEmptyArray(.requiredFieldIsMissing(field: "type"))) - } - - switch type { - case DivKeyboardInput.type: - let result = DivKeyboardInputTemplate.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divKeyboardInput(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divKeyboardInput(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - case DivSelectionInput.type: - let result = DivSelectionInputTemplate.resolveValue(context: context, useOnlyLinks: useOnlyLinks) - switch result { - case let .success(value): return .success(.divSelectionInput(value)) - case let .partialSuccess(value, warnings): return .partialSuccess(.divSelectionInput(value), warnings: warnings) - case let .failure(errors): return .failure(errors) - case .noValue: return .noValue - } - default: - return .failure(NonEmptyArray(.requiredFieldIsMissing(field: "type"))) - } - } -} - -extension DivInputMethodTemplate: TemplateDeserializable { - public init(dictionary: [String: Any], templateToType: TemplateToType) throws { - let receivedType = try dictionary.getField("type") as String - let blockType = templateToType[receivedType] ?? receivedType - switch blockType { - case DivKeyboardInputTemplate.type: - self = .divKeyboardInputTemplate(try DivKeyboardInputTemplate(dictionary: dictionary, templateToType: templateToType)) - case DivSelectionInputTemplate.type: - self = .divSelectionInputTemplate(try DivSelectionInputTemplate(dictionary: dictionary, templateToType: templateToType)) - default: - throw DeserializationError.invalidFieldRepresentation(field: "div-input-method_template", representation: dictionary) - } - } -} diff --git a/DivKit/generated_sources/DivInputTemplate.swift b/DivKit/generated_sources/DivInputTemplate.swift index c4212d41..f71540ec 100644 --- a/DivKit/generated_sources/DivInputTemplate.swift +++ b/DivKit/generated_sources/DivInputTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport @@ -106,12 +106,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { public let hintColor: Field>? // default value: #73000000 public let hintText: Field>? // at least 1 char public let id: Field? // at least 1 char - public let inputMethod: Field? public let keyboardType: Field>? // default value: multi_line_text public let letterSpacing: Field>? // default value: 0 public let lineHeight: Field>? // constraint: number >= 0 public let margins: Field? - public let mask: Field? public let maxVisibleLines: Field>? // constraint: number > 0 public let nativeInterface: Field? public let paddings: Field? @@ -156,12 +154,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: try dictionary.getOptionalExpressionField("hint_color", transform: Color.color(withHexString:)), hintText: try dictionary.getOptionalExpressionField("hint_text"), id: try dictionary.getOptionalField("id"), - inputMethod: try dictionary.getOptionalField("input_method", templateToType: templateToType), keyboardType: try dictionary.getOptionalExpressionField("keyboard_type"), letterSpacing: try dictionary.getOptionalExpressionField("letter_spacing"), lineHeight: try dictionary.getOptionalExpressionField("line_height"), margins: try dictionary.getOptionalField("margins", templateToType: templateToType), - mask: try dictionary.getOptionalField("mask", templateToType: templateToType), maxVisibleLines: try dictionary.getOptionalExpressionField("max_visible_lines"), nativeInterface: try dictionary.getOptionalField("native_interface", templateToType: templateToType), paddings: try dictionary.getOptionalField("paddings", templateToType: templateToType), @@ -206,12 +202,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: Field>? = nil, hintText: Field>? = nil, id: Field? = nil, - inputMethod: Field? = nil, keyboardType: Field>? = nil, letterSpacing: Field>? = nil, lineHeight: Field>? = nil, margins: Field? = nil, - mask: Field? = nil, maxVisibleLines: Field>? = nil, nativeInterface: Field? = nil, paddings: Field? = nil, @@ -250,12 +244,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { self.hintColor = hintColor self.hintText = hintText self.id = id - self.inputMethod = inputMethod self.keyboardType = keyboardType self.letterSpacing = letterSpacing self.lineHeight = lineHeight self.margins = margins - self.mask = mask self.maxVisibleLines = maxVisibleLines self.nativeInterface = nativeInterface self.paddings = paddings @@ -295,12 +287,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { let hintColorValue = parent?.hintColor?.resolveOptionalValue(context: context, transform: Color.color(withHexString:), validator: ResolvedValue.hintColorValidator) ?? .noValue let hintTextValue = parent?.hintText?.resolveOptionalValue(context: context, validator: ResolvedValue.hintTextValidator) ?? .noValue let idValue = parent?.id?.resolveOptionalValue(context: context, validator: ResolvedValue.idValidator) ?? .noValue - let inputMethodValue = parent?.inputMethod?.resolveOptionalValue(context: context, validator: ResolvedValue.inputMethodValidator, useOnlyLinks: true) ?? .noValue let keyboardTypeValue = parent?.keyboardType?.resolveOptionalValue(context: context, validator: ResolvedValue.keyboardTypeValidator) ?? .noValue let letterSpacingValue = parent?.letterSpacing?.resolveOptionalValue(context: context) ?? .noValue let lineHeightValue = parent?.lineHeight?.resolveOptionalValue(context: context, validator: ResolvedValue.lineHeightValidator) ?? .noValue let marginsValue = parent?.margins?.resolveOptionalValue(context: context, validator: ResolvedValue.marginsValidator, useOnlyLinks: true) ?? .noValue - let maskValue = parent?.mask?.resolveOptionalValue(context: context, validator: ResolvedValue.maskValidator, useOnlyLinks: true) ?? .noValue let maxVisibleLinesValue = parent?.maxVisibleLines?.resolveOptionalValue(context: context, validator: ResolvedValue.maxVisibleLinesValidator) ?? .noValue let nativeInterfaceValue = parent?.nativeInterface?.resolveOptionalValue(context: context, validator: ResolvedValue.nativeInterfaceValidator, useOnlyLinks: true) ?? .noValue let paddingsValue = parent?.paddings?.resolveOptionalValue(context: context, validator: ResolvedValue.paddingsValidator, useOnlyLinks: true) ?? .noValue @@ -338,12 +328,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, hintTextValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_text", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, - inputMethodValue.errorsOrWarnings?.map { .nestedObjectError(field: "input_method", error: $0) }, keyboardTypeValue.errorsOrWarnings?.map { .nestedObjectError(field: "keyboard_type", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, marginsValue.errorsOrWarnings?.map { .nestedObjectError(field: "margins", error: $0) }, - maskValue.errorsOrWarnings?.map { .nestedObjectError(field: "mask", error: $0) }, maxVisibleLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "max_visible_lines", error: $0) }, nativeInterfaceValue.errorsOrWarnings?.map { .nestedObjectError(field: "native_interface", error: $0) }, paddingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "paddings", error: $0) }, @@ -390,12 +378,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: hintColorValue.value, hintText: hintTextValue.value, id: idValue.value, - inputMethod: inputMethodValue.value, keyboardType: keyboardTypeValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, margins: marginsValue.value, - mask: maskValue.value, maxVisibleLines: maxVisibleLinesValue.value, nativeInterface: nativeInterfaceValue.value, paddings: paddingsValue.value, @@ -440,12 +426,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { var hintColorValue: DeserializationResult> = parent?.hintColor?.value() ?? .noValue var hintTextValue: DeserializationResult> = parent?.hintText?.value() ?? .noValue var idValue: DeserializationResult = parent?.id?.value(validatedBy: ResolvedValue.idValidator) ?? .noValue - var inputMethodValue: DeserializationResult = .noValue var keyboardTypeValue: DeserializationResult> = parent?.keyboardType?.value() ?? .noValue var letterSpacingValue: DeserializationResult> = parent?.letterSpacing?.value() ?? .noValue var lineHeightValue: DeserializationResult> = parent?.lineHeight?.value() ?? .noValue var marginsValue: DeserializationResult = .noValue - var maskValue: DeserializationResult = .noValue var maxVisibleLinesValue: DeserializationResult> = parent?.maxVisibleLines?.value() ?? .noValue var nativeInterfaceValue: DeserializationResult = .noValue var paddingsValue: DeserializationResult = .noValue @@ -502,8 +486,6 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintTextValue = deserialize(__dictValue, validator: ResolvedValue.hintTextValidator).merged(with: hintTextValue) case "id": idValue = deserialize(__dictValue, validator: ResolvedValue.idValidator).merged(with: idValue) - case "input_method": - inputMethodValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.inputMethodValidator, type: DivInputMethodTemplate.self).merged(with: inputMethodValue) case "keyboard_type": keyboardTypeValue = deserialize(__dictValue, validator: ResolvedValue.keyboardTypeValidator).merged(with: keyboardTypeValue) case "letter_spacing": @@ -512,8 +494,6 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { lineHeightValue = deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator).merged(with: lineHeightValue) case "margins": marginsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.marginsValidator, type: DivEdgeInsetsTemplate.self).merged(with: marginsValue) - case "mask": - maskValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.maskValidator, type: DivInputMaskTemplate.self).merged(with: maskValue) case "max_visible_lines": maxVisibleLinesValue = deserialize(__dictValue, validator: ResolvedValue.maxVisibleLinesValidator).merged(with: maxVisibleLinesValue) case "native_interface": @@ -586,8 +566,6 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintTextValue = hintTextValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.hintTextValidator)) case parent?.id?.link: idValue = idValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.idValidator)) - case parent?.inputMethod?.link: - inputMethodValue = inputMethodValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.inputMethodValidator, type: DivInputMethodTemplate.self)) case parent?.keyboardType?.link: keyboardTypeValue = keyboardTypeValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.keyboardTypeValidator)) case parent?.letterSpacing?.link: @@ -596,8 +574,6 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { lineHeightValue = lineHeightValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.lineHeightValidator)) case parent?.margins?.link: marginsValue = marginsValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.marginsValidator, type: DivEdgeInsetsTemplate.self)) - case parent?.mask?.link: - maskValue = maskValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.maskValidator, type: DivInputMaskTemplate.self)) case parent?.maxVisibleLines?.link: maxVisibleLinesValue = maxVisibleLinesValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.maxVisibleLinesValidator)) case parent?.nativeInterface?.link: @@ -644,9 +620,7 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { extensionsValue = extensionsValue.merged(with: parent.extensions?.resolveOptionalValue(context: context, validator: ResolvedValue.extensionsValidator, useOnlyLinks: true)) focusValue = focusValue.merged(with: parent.focus?.resolveOptionalValue(context: context, validator: ResolvedValue.focusValidator, useOnlyLinks: true)) heightValue = heightValue.merged(with: parent.height?.resolveOptionalValue(context: context, validator: ResolvedValue.heightValidator, useOnlyLinks: true)) - inputMethodValue = inputMethodValue.merged(with: parent.inputMethod?.resolveOptionalValue(context: context, validator: ResolvedValue.inputMethodValidator, useOnlyLinks: true)) marginsValue = marginsValue.merged(with: parent.margins?.resolveOptionalValue(context: context, validator: ResolvedValue.marginsValidator, useOnlyLinks: true)) - maskValue = maskValue.merged(with: parent.mask?.resolveOptionalValue(context: context, validator: ResolvedValue.maskValidator, useOnlyLinks: true)) nativeInterfaceValue = nativeInterfaceValue.merged(with: parent.nativeInterface?.resolveOptionalValue(context: context, validator: ResolvedValue.nativeInterfaceValidator, useOnlyLinks: true)) paddingsValue = paddingsValue.merged(with: parent.paddings?.resolveOptionalValue(context: context, validator: ResolvedValue.paddingsValidator, useOnlyLinks: true)) selectedActionsValue = selectedActionsValue.merged(with: parent.selectedActions?.resolveOptionalValue(context: context, validator: ResolvedValue.selectedActionsValidator, useOnlyLinks: true)) @@ -678,12 +652,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColorValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_color", error: $0) }, hintTextValue.errorsOrWarnings?.map { .nestedObjectError(field: "hint_text", error: $0) }, idValue.errorsOrWarnings?.map { .nestedObjectError(field: "id", error: $0) }, - inputMethodValue.errorsOrWarnings?.map { .nestedObjectError(field: "input_method", error: $0) }, keyboardTypeValue.errorsOrWarnings?.map { .nestedObjectError(field: "keyboard_type", error: $0) }, letterSpacingValue.errorsOrWarnings?.map { .nestedObjectError(field: "letter_spacing", error: $0) }, lineHeightValue.errorsOrWarnings?.map { .nestedObjectError(field: "line_height", error: $0) }, marginsValue.errorsOrWarnings?.map { .nestedObjectError(field: "margins", error: $0) }, - maskValue.errorsOrWarnings?.map { .nestedObjectError(field: "mask", error: $0) }, maxVisibleLinesValue.errorsOrWarnings?.map { .nestedObjectError(field: "max_visible_lines", error: $0) }, nativeInterfaceValue.errorsOrWarnings?.map { .nestedObjectError(field: "native_interface", error: $0) }, paddingsValue.errorsOrWarnings?.map { .nestedObjectError(field: "paddings", error: $0) }, @@ -730,12 +702,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: hintColorValue.value, hintText: hintTextValue.value, id: idValue.value, - inputMethod: inputMethodValue.value, keyboardType: keyboardTypeValue.value, letterSpacing: letterSpacingValue.value, lineHeight: lineHeightValue.value, margins: marginsValue.value, - mask: maskValue.value, maxVisibleLines: maxVisibleLinesValue.value, nativeInterface: nativeInterfaceValue.value, paddings: paddingsValue.value, @@ -785,12 +755,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: hintColor ?? mergedParent.hintColor, hintText: hintText ?? mergedParent.hintText, id: id ?? mergedParent.id, - inputMethod: inputMethod ?? mergedParent.inputMethod, keyboardType: keyboardType ?? mergedParent.keyboardType, letterSpacing: letterSpacing ?? mergedParent.letterSpacing, lineHeight: lineHeight ?? mergedParent.lineHeight, margins: margins ?? mergedParent.margins, - mask: mask ?? mergedParent.mask, maxVisibleLines: maxVisibleLines ?? mergedParent.maxVisibleLines, nativeInterface: nativeInterface ?? mergedParent.nativeInterface, paddings: paddings ?? mergedParent.paddings, @@ -835,12 +803,10 @@ public final class DivInputTemplate: TemplateValue, TemplateDeserializable { hintColor: merged.hintColor, hintText: merged.hintText, id: merged.id, - inputMethod: merged.inputMethod?.tryResolveParent(templates: templates), keyboardType: merged.keyboardType, letterSpacing: merged.letterSpacing, lineHeight: merged.lineHeight, margins: merged.margins?.tryResolveParent(templates: templates), - mask: merged.mask?.tryResolveParent(templates: templates), maxVisibleLines: merged.maxVisibleLines, nativeInterface: merged.nativeInterface?.tryResolveParent(templates: templates), paddings: merged.paddings?.tryResolveParent(templates: templates), diff --git a/DivKit/generated_sources/DivKeyboardInput.swift b/DivKit/generated_sources/DivKeyboardInput.swift deleted file mode 100644 index 2e165b69..00000000 --- a/DivKit/generated_sources/DivKeyboardInput.swift +++ /dev/null @@ -1,56 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -public final class DivKeyboardInput { - @frozen - public enum KeyboardType: String, CaseIterable { - case singleLineText = "single_line_text" - case multiLineText = "multi_line_text" - case phone = "phone" - case number = "number" - case email = "email" - case uri = "uri" - } - - public static let type: String = "keyboard" - public let keyboardType: Expression // default value: multi_line_text - - public func resolveKeyboardType(_ resolver: ExpressionResolver) -> KeyboardType { - resolver.resolveStringBasedValue(expression: keyboardType, initializer: KeyboardType.init(rawValue:)) ?? KeyboardType.multiLineText - } - - static let keyboardTypeValidator: AnyValueValidator = - makeNoOpValueValidator() - - init( - keyboardType: Expression? = nil - ) { - self.keyboardType = keyboardType ?? .value(.multiLineText) - } -} - -#if DEBUG -extension DivKeyboardInput: Equatable { - public static func ==(lhs: DivKeyboardInput, rhs: DivKeyboardInput) -> Bool { - guard - lhs.keyboardType == rhs.keyboardType - else { - return false - } - return true - } -} -#endif - -extension DivKeyboardInput: Serializable { - public func toDictionary() -> [String: ValidSerializationValue] { - var result: [String: ValidSerializationValue] = [:] - result["type"] = Self.type - result["keyboard_type"] = keyboardType.toValidSerializationValue() - return result - } -} diff --git a/DivKit/generated_sources/DivKeyboardInputTemplate.swift b/DivKit/generated_sources/DivKeyboardInputTemplate.swift deleted file mode 100644 index cb963789..00000000 --- a/DivKit/generated_sources/DivKeyboardInputTemplate.swift +++ /dev/null @@ -1,83 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -public final class DivKeyboardInputTemplate: TemplateValue, TemplateDeserializable { - public typealias KeyboardType = DivKeyboardInput.KeyboardType - - public static let type: String = "keyboard" - public let parent: String? // at least 1 char - public let keyboardType: Field>? // default value: multi_line_text - - static let parentValidator: AnyValueValidator = - makeStringValidator(minLength: 1) - - public convenience init(dictionary: [String: Any], templateToType: TemplateToType) throws { - self.init( - parent: try dictionary.getOptionalField("type", validator: Self.parentValidator), - keyboardType: try dictionary.getOptionalExpressionField("keyboard_type") - ) - } - - init( - parent: String?, - keyboardType: Field>? = nil - ) { - self.parent = parent - self.keyboardType = keyboardType - } - - private static func resolveOnlyLinks(context: Context, parent: DivKeyboardInputTemplate?) -> DeserializationResult { - let keyboardTypeValue = parent?.keyboardType?.resolveOptionalValue(context: context, validator: ResolvedValue.keyboardTypeValidator) ?? .noValue - let errors = mergeErrors( - keyboardTypeValue.errorsOrWarnings?.map { .nestedObjectError(field: "keyboard_type", error: $0) } - ) - let result = DivKeyboardInput( - keyboardType: keyboardTypeValue.value - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - public static func resolveValue(context: Context, parent: DivKeyboardInputTemplate?, useOnlyLinks: Bool) -> DeserializationResult { - if useOnlyLinks { - return resolveOnlyLinks(context: context, parent: parent) - } - var keyboardTypeValue: DeserializationResult> = parent?.keyboardType?.value() ?? .noValue - context.templateData.forEach { key, __dictValue in - switch key { - case "keyboard_type": - keyboardTypeValue = deserialize(__dictValue, validator: ResolvedValue.keyboardTypeValidator).merged(with: keyboardTypeValue) - case parent?.keyboardType?.link: - keyboardTypeValue = keyboardTypeValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.keyboardTypeValidator)) - default: break - } - } - let errors = mergeErrors( - keyboardTypeValue.errorsOrWarnings?.map { .nestedObjectError(field: "keyboard_type", error: $0) } - ) - let result = DivKeyboardInput( - keyboardType: keyboardTypeValue.value - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - private func mergedWithParent(templates: Templates) throws -> DivKeyboardInputTemplate { - guard let parent = parent, parent != Self.type else { return self } - guard let parentTemplate = templates[parent] as? DivKeyboardInputTemplate else { - throw DeserializationError.unknownType(type: parent) - } - let mergedParent = try parentTemplate.mergedWithParent(templates: templates) - - return DivKeyboardInputTemplate( - parent: nil, - keyboardType: keyboardType ?? mergedParent.keyboardType - ) - } - - public func resolveParent(templates: Templates) throws -> DivKeyboardInputTemplate { - return try mergedWithParent(templates: templates) - } -} diff --git a/DivKit/generated_sources/DivLineStyle.swift b/DivKit/generated_sources/DivLineStyle.swift index 6137fa53..c5e608ec 100644 --- a/DivKit/generated_sources/DivLineStyle.swift +++ b/DivKit/generated_sources/DivLineStyle.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivLinearGradient.swift b/DivKit/generated_sources/DivLinearGradient.swift index bb88d553..01be8d36 100644 --- a/DivKit/generated_sources/DivLinearGradient.swift +++ b/DivKit/generated_sources/DivLinearGradient.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivLinearGradientTemplate.swift b/DivKit/generated_sources/DivLinearGradientTemplate.swift index 20f80ec7..d0886dea 100644 --- a/DivKit/generated_sources/DivLinearGradientTemplate.swift +++ b/DivKit/generated_sources/DivLinearGradientTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivMatchParentSize.swift b/DivKit/generated_sources/DivMatchParentSize.swift index dcea4c3f..4fe45f8a 100644 --- a/DivKit/generated_sources/DivMatchParentSize.swift +++ b/DivKit/generated_sources/DivMatchParentSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivMatchParentSizeTemplate.swift b/DivKit/generated_sources/DivMatchParentSizeTemplate.swift index 5733f9c6..1d18ee21 100644 --- a/DivKit/generated_sources/DivMatchParentSizeTemplate.swift +++ b/DivKit/generated_sources/DivMatchParentSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivNeighbourPageSize.swift b/DivKit/generated_sources/DivNeighbourPageSize.swift index 97da39aa..fc4561c9 100644 --- a/DivKit/generated_sources/DivNeighbourPageSize.swift +++ b/DivKit/generated_sources/DivNeighbourPageSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivNeighbourPageSizeTemplate.swift b/DivKit/generated_sources/DivNeighbourPageSizeTemplate.swift index bb86a501..6fb09b3d 100644 --- a/DivKit/generated_sources/DivNeighbourPageSizeTemplate.swift +++ b/DivKit/generated_sources/DivNeighbourPageSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivNinePatchBackground.swift b/DivKit/generated_sources/DivNinePatchBackground.swift index c79890f9..0c5f88a2 100644 --- a/DivKit/generated_sources/DivNinePatchBackground.swift +++ b/DivKit/generated_sources/DivNinePatchBackground.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivNinePatchBackgroundTemplate.swift b/DivKit/generated_sources/DivNinePatchBackgroundTemplate.swift index 30b11fa9..7ccfa248 100644 --- a/DivKit/generated_sources/DivNinePatchBackgroundTemplate.swift +++ b/DivKit/generated_sources/DivNinePatchBackgroundTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPageSize.swift b/DivKit/generated_sources/DivPageSize.swift index 7ff66f9d..53f5984e 100644 --- a/DivKit/generated_sources/DivPageSize.swift +++ b/DivKit/generated_sources/DivPageSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPageSizeTemplate.swift b/DivKit/generated_sources/DivPageSizeTemplate.swift index 00acecfb..ed77dca9 100644 --- a/DivKit/generated_sources/DivPageSizeTemplate.swift +++ b/DivKit/generated_sources/DivPageSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPager.swift b/DivKit/generated_sources/DivPager.swift index f9c1ae06..5cbb79ab 100644 --- a/DivKit/generated_sources/DivPager.swift +++ b/DivKit/generated_sources/DivPager.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPagerLayoutMode.swift b/DivKit/generated_sources/DivPagerLayoutMode.swift index a92b7370..80c8e088 100644 --- a/DivKit/generated_sources/DivPagerLayoutMode.swift +++ b/DivKit/generated_sources/DivPagerLayoutMode.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPagerLayoutModeTemplate.swift b/DivKit/generated_sources/DivPagerLayoutModeTemplate.swift index c807aa60..dfe28809 100644 --- a/DivKit/generated_sources/DivPagerLayoutModeTemplate.swift +++ b/DivKit/generated_sources/DivPagerLayoutModeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPagerTemplate.swift b/DivKit/generated_sources/DivPagerTemplate.swift index 666fa5f7..260c0b37 100644 --- a/DivKit/generated_sources/DivPagerTemplate.swift +++ b/DivKit/generated_sources/DivPagerTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPatch.swift b/DivKit/generated_sources/DivPatch.swift index ae524238..c97de661 100644 --- a/DivKit/generated_sources/DivPatch.swift +++ b/DivKit/generated_sources/DivPatch.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPatchTemplate.swift b/DivKit/generated_sources/DivPatchTemplate.swift index 8f67ba16..b54e2d41 100644 --- a/DivKit/generated_sources/DivPatchTemplate.swift +++ b/DivKit/generated_sources/DivPatchTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPercentageSize.swift b/DivKit/generated_sources/DivPercentageSize.swift index d07f2b4e..4df5cfda 100644 --- a/DivKit/generated_sources/DivPercentageSize.swift +++ b/DivKit/generated_sources/DivPercentageSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPercentageSizeTemplate.swift b/DivKit/generated_sources/DivPercentageSizeTemplate.swift index d5d9d794..8629fdd1 100644 --- a/DivKit/generated_sources/DivPercentageSizeTemplate.swift +++ b/DivKit/generated_sources/DivPercentageSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivot.swift b/DivKit/generated_sources/DivPivot.swift index 355f302f..f911d172 100644 --- a/DivKit/generated_sources/DivPivot.swift +++ b/DivKit/generated_sources/DivPivot.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivotFixed.swift b/DivKit/generated_sources/DivPivotFixed.swift index 7aca9564..8369ebed 100644 --- a/DivKit/generated_sources/DivPivotFixed.swift +++ b/DivKit/generated_sources/DivPivotFixed.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivotFixedTemplate.swift b/DivKit/generated_sources/DivPivotFixedTemplate.swift index 20b3a74f..78bcb0aa 100644 --- a/DivKit/generated_sources/DivPivotFixedTemplate.swift +++ b/DivKit/generated_sources/DivPivotFixedTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivotPercentage.swift b/DivKit/generated_sources/DivPivotPercentage.swift index d1ba6d70..0eebc203 100644 --- a/DivKit/generated_sources/DivPivotPercentage.swift +++ b/DivKit/generated_sources/DivPivotPercentage.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivotPercentageTemplate.swift b/DivKit/generated_sources/DivPivotPercentageTemplate.swift index 9e1c4886..e9d8be23 100644 --- a/DivKit/generated_sources/DivPivotPercentageTemplate.swift +++ b/DivKit/generated_sources/DivPivotPercentageTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPivotTemplate.swift b/DivKit/generated_sources/DivPivotTemplate.swift index 037685fe..0535d29c 100644 --- a/DivKit/generated_sources/DivPivotTemplate.swift +++ b/DivKit/generated_sources/DivPivotTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPoint.swift b/DivKit/generated_sources/DivPoint.swift index bc68d75b..195d5d0c 100644 --- a/DivKit/generated_sources/DivPoint.swift +++ b/DivKit/generated_sources/DivPoint.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivPointTemplate.swift b/DivKit/generated_sources/DivPointTemplate.swift index d8fa6e70..60de84e9 100644 --- a/DivKit/generated_sources/DivPointTemplate.swift +++ b/DivKit/generated_sources/DivPointTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradient.swift b/DivKit/generated_sources/DivRadialGradient.swift index 7dcb3325..7e7c5b60 100644 --- a/DivKit/generated_sources/DivRadialGradient.swift +++ b/DivKit/generated_sources/DivRadialGradient.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientCenter.swift b/DivKit/generated_sources/DivRadialGradientCenter.swift index 6fac09c0..0d94512c 100644 --- a/DivKit/generated_sources/DivRadialGradientCenter.swift +++ b/DivKit/generated_sources/DivRadialGradientCenter.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientCenterTemplate.swift b/DivKit/generated_sources/DivRadialGradientCenterTemplate.swift index 3a132c41..0db95a60 100644 --- a/DivKit/generated_sources/DivRadialGradientCenterTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientCenterTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientFixedCenter.swift b/DivKit/generated_sources/DivRadialGradientFixedCenter.swift index df1b137a..90f79bb1 100644 --- a/DivKit/generated_sources/DivRadialGradientFixedCenter.swift +++ b/DivKit/generated_sources/DivRadialGradientFixedCenter.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientFixedCenterTemplate.swift b/DivKit/generated_sources/DivRadialGradientFixedCenterTemplate.swift index 2e9439bc..d61917d4 100644 --- a/DivKit/generated_sources/DivRadialGradientFixedCenterTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientFixedCenterTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRadius.swift b/DivKit/generated_sources/DivRadialGradientRadius.swift index 905147ee..644ba4dd 100644 --- a/DivKit/generated_sources/DivRadialGradientRadius.swift +++ b/DivKit/generated_sources/DivRadialGradientRadius.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRadiusTemplate.swift b/DivKit/generated_sources/DivRadialGradientRadiusTemplate.swift index ca04be18..6bb6b8ff 100644 --- a/DivKit/generated_sources/DivRadialGradientRadiusTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientRadiusTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRelativeCenter.swift b/DivKit/generated_sources/DivRadialGradientRelativeCenter.swift index d22a9959..473ec49d 100644 --- a/DivKit/generated_sources/DivRadialGradientRelativeCenter.swift +++ b/DivKit/generated_sources/DivRadialGradientRelativeCenter.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRelativeCenterTemplate.swift b/DivKit/generated_sources/DivRadialGradientRelativeCenterTemplate.swift index 2cc89175..14d85ba0 100644 --- a/DivKit/generated_sources/DivRadialGradientRelativeCenterTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientRelativeCenterTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRelativeRadius.swift b/DivKit/generated_sources/DivRadialGradientRelativeRadius.swift index b530ed5d..59714f6a 100644 --- a/DivKit/generated_sources/DivRadialGradientRelativeRadius.swift +++ b/DivKit/generated_sources/DivRadialGradientRelativeRadius.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientRelativeRadiusTemplate.swift b/DivKit/generated_sources/DivRadialGradientRelativeRadiusTemplate.swift index d5b26532..fab5d23e 100644 --- a/DivKit/generated_sources/DivRadialGradientRelativeRadiusTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientRelativeRadiusTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRadialGradientTemplate.swift b/DivKit/generated_sources/DivRadialGradientTemplate.swift index 1c3add9f..7f494d5c 100644 --- a/DivKit/generated_sources/DivRadialGradientTemplate.swift +++ b/DivKit/generated_sources/DivRadialGradientTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRoundedRectangleShape.swift b/DivKit/generated_sources/DivRoundedRectangleShape.swift index ac0507fd..9c6407a4 100644 --- a/DivKit/generated_sources/DivRoundedRectangleShape.swift +++ b/DivKit/generated_sources/DivRoundedRectangleShape.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivRoundedRectangleShapeTemplate.swift b/DivKit/generated_sources/DivRoundedRectangleShapeTemplate.swift index 54a759cd..9e0b6f25 100644 --- a/DivKit/generated_sources/DivRoundedRectangleShapeTemplate.swift +++ b/DivKit/generated_sources/DivRoundedRectangleShapeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivScaleTransition.swift b/DivKit/generated_sources/DivScaleTransition.swift index 02f40fe5..95d629ec 100644 --- a/DivKit/generated_sources/DivScaleTransition.swift +++ b/DivKit/generated_sources/DivScaleTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivScaleTransitionTemplate.swift b/DivKit/generated_sources/DivScaleTransitionTemplate.swift index fe52274b..b3199d6e 100644 --- a/DivKit/generated_sources/DivScaleTransitionTemplate.swift +++ b/DivKit/generated_sources/DivScaleTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSelectionInput.swift b/DivKit/generated_sources/DivSelectionInput.swift deleted file mode 100644 index 4d044363..00000000 --- a/DivKit/generated_sources/DivSelectionInput.swift +++ /dev/null @@ -1,92 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -public final class DivSelectionInput { - public final class Item { - public let text: Expression // at least 1 char - public let value: Expression? // at least 1 char - - public func resolveText(_ resolver: ExpressionResolver) -> String? { - resolver.resolveStringBasedValue(expression: text, initializer: { $0 }) - } - - public func resolveValue(_ resolver: ExpressionResolver) -> String? { - resolver.resolveStringBasedValue(expression: value, initializer: { $0 }) - } - - static let textValidator: AnyValueValidator = - makeStringValidator(minLength: 1) - - static let valueValidator: AnyValueValidator = - makeStringValidator(minLength: 1) - - init( - text: Expression, - value: Expression? = nil - ) { - self.text = text - self.value = value - } - } - - public static let type: String = "selection" - public let items: [Item] // at least 1 elements - - static let itemsValidator: AnyArrayValueValidator = - makeArrayValidator(minItems: 1) - - init( - items: [Item] - ) { - self.items = items - } -} - -#if DEBUG -extension DivSelectionInput: Equatable { - public static func ==(lhs: DivSelectionInput, rhs: DivSelectionInput) -> Bool { - guard - lhs.items == rhs.items - else { - return false - } - return true - } -} -#endif - -extension DivSelectionInput: Serializable { - public func toDictionary() -> [String: ValidSerializationValue] { - var result: [String: ValidSerializationValue] = [:] - result["type"] = Self.type - result["items"] = items.map { $0.toDictionary() } - return result - } -} - -#if DEBUG -extension DivSelectionInput.Item: Equatable { - public static func ==(lhs: DivSelectionInput.Item, rhs: DivSelectionInput.Item) -> Bool { - guard - lhs.text == rhs.text, - lhs.value == rhs.value - else { - return false - } - return true - } -} -#endif - -extension DivSelectionInput.Item: Serializable { - public func toDictionary() -> [String: ValidSerializationValue] { - var result: [String: ValidSerializationValue] = [:] - result["text"] = text.toValidSerializationValue() - result["value"] = value?.toValidSerializationValue() - return result - } -} diff --git a/DivKit/generated_sources/DivSelectionInputTemplate.swift b/DivKit/generated_sources/DivSelectionInputTemplate.swift deleted file mode 100644 index 32737dfe..00000000 --- a/DivKit/generated_sources/DivSelectionInputTemplate.swift +++ /dev/null @@ -1,201 +0,0 @@ -// Generated code. Do not modify. - -import CommonCore -import Foundation -import Serialization -import TemplatesSupport - -public final class DivSelectionInputTemplate: TemplateValue, TemplateDeserializable { - public final class ItemTemplate: TemplateValue, TemplateDeserializable { - public let text: Field>? // at least 1 char - public let value: Field>? // at least 1 char - - public convenience init(dictionary: [String: Any], templateToType: TemplateToType) throws { - do { - self.init( - text: try dictionary.getOptionalExpressionField("text"), - value: try dictionary.getOptionalExpressionField("value") - ) - } catch let DeserializationError.invalidFieldRepresentation(field: field, representation: representation) { - throw DeserializationError.invalidFieldRepresentation(field: "item_template." + field, representation: representation) - } - } - - init( - text: Field>? = nil, - value: Field>? = nil - ) { - self.text = text - self.value = value - } - - private static func resolveOnlyLinks(context: Context, parent: ItemTemplate?) -> DeserializationResult { - let textValue = parent?.text?.resolveValue(context: context, validator: ResolvedValue.textValidator) ?? .noValue - let valueValue = parent?.value?.resolveOptionalValue(context: context, validator: ResolvedValue.valueValidator) ?? .noValue - var errors = mergeErrors( - textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) }, - valueValue.errorsOrWarnings?.map { .nestedObjectError(field: "value", error: $0) } - ) - if case .noValue = textValue { - errors.append(.requiredFieldIsMissing(field: "text")) - } - guard - let textNonNil = textValue.value - else { - return .failure(NonEmptyArray(errors)!) - } - let result = DivSelectionInput.Item( - text: textNonNil, - value: valueValue.value - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - public static func resolveValue(context: Context, parent: ItemTemplate?, useOnlyLinks: Bool) -> DeserializationResult { - if useOnlyLinks { - return resolveOnlyLinks(context: context, parent: parent) - } - var textValue: DeserializationResult> = parent?.text?.value() ?? .noValue - var valueValue: DeserializationResult> = parent?.value?.value() ?? .noValue - context.templateData.forEach { key, __dictValue in - switch key { - case "text": - textValue = deserialize(__dictValue, validator: ResolvedValue.textValidator).merged(with: textValue) - case "value": - valueValue = deserialize(__dictValue, validator: ResolvedValue.valueValidator).merged(with: valueValue) - case parent?.text?.link: - textValue = textValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.textValidator)) - case parent?.value?.link: - valueValue = valueValue.merged(with: deserialize(__dictValue, validator: ResolvedValue.valueValidator)) - default: break - } - } - var errors = mergeErrors( - textValue.errorsOrWarnings?.map { .nestedObjectError(field: "text", error: $0) }, - valueValue.errorsOrWarnings?.map { .nestedObjectError(field: "value", error: $0) } - ) - if case .noValue = textValue { - errors.append(.requiredFieldIsMissing(field: "text")) - } - guard - let textNonNil = textValue.value - else { - return .failure(NonEmptyArray(errors)!) - } - let result = DivSelectionInput.Item( - text: textNonNil, - value: valueValue.value - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - private func mergedWithParent(templates: Templates) throws -> ItemTemplate { - return self - } - - public func resolveParent(templates: Templates) throws -> ItemTemplate { - return try mergedWithParent(templates: templates) - } - } - - public static let type: String = "selection" - public let parent: String? // at least 1 char - public let items: Field<[ItemTemplate]>? // at least 1 elements - - static let parentValidator: AnyValueValidator = - makeStringValidator(minLength: 1) - - public convenience init(dictionary: [String: Any], templateToType: TemplateToType) throws { - do { - self.init( - parent: try dictionary.getOptionalField("type", validator: Self.parentValidator), - items: try dictionary.getOptionalArray("items", templateToType: templateToType) - ) - } catch let DeserializationError.invalidFieldRepresentation(field: field, representation: representation) { - throw DeserializationError.invalidFieldRepresentation(field: "div-selection-input_template." + field, representation: representation) - } - } - - init( - parent: String?, - items: Field<[ItemTemplate]>? = nil - ) { - self.parent = parent - self.items = items - } - - private static func resolveOnlyLinks(context: Context, parent: DivSelectionInputTemplate?) -> DeserializationResult { - let itemsValue = parent?.items?.resolveValue(context: context, validator: ResolvedValue.itemsValidator, useOnlyLinks: true) ?? .noValue - var errors = mergeErrors( - itemsValue.errorsOrWarnings?.map { .nestedObjectError(field: "items", error: $0) } - ) - if case .noValue = itemsValue { - errors.append(.requiredFieldIsMissing(field: "items")) - } - guard - let itemsNonNil = itemsValue.value - else { - return .failure(NonEmptyArray(errors)!) - } - let result = DivSelectionInput( - items: itemsNonNil - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - public static func resolveValue(context: Context, parent: DivSelectionInputTemplate?, useOnlyLinks: Bool) -> DeserializationResult { - if useOnlyLinks { - return resolveOnlyLinks(context: context, parent: parent) - } - var itemsValue: DeserializationResult<[DivSelectionInput.Item]> = .noValue - context.templateData.forEach { key, __dictValue in - switch key { - case "items": - itemsValue = deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.itemsValidator, type: DivSelectionInputTemplate.ItemTemplate.self).merged(with: itemsValue) - case parent?.items?.link: - itemsValue = itemsValue.merged(with: deserialize(__dictValue, templates: context.templates, templateToType: context.templateToType, validator: ResolvedValue.itemsValidator, type: DivSelectionInputTemplate.ItemTemplate.self)) - default: break - } - } - if let parent = parent { - itemsValue = itemsValue.merged(with: parent.items?.resolveValue(context: context, validator: ResolvedValue.itemsValidator, useOnlyLinks: true)) - } - var errors = mergeErrors( - itemsValue.errorsOrWarnings?.map { .nestedObjectError(field: "items", error: $0) } - ) - if case .noValue = itemsValue { - errors.append(.requiredFieldIsMissing(field: "items")) - } - guard - let itemsNonNil = itemsValue.value - else { - return .failure(NonEmptyArray(errors)!) - } - let result = DivSelectionInput( - items: itemsNonNil - ) - return errors.isEmpty ? .success(result) : .partialSuccess(result, warnings: NonEmptyArray(errors)!) - } - - private func mergedWithParent(templates: Templates) throws -> DivSelectionInputTemplate { - guard let parent = parent, parent != Self.type else { return self } - guard let parentTemplate = templates[parent] as? DivSelectionInputTemplate else { - throw DeserializationError.unknownType(type: parent) - } - let mergedParent = try parentTemplate.mergedWithParent(templates: templates) - - return DivSelectionInputTemplate( - parent: nil, - items: items ?? mergedParent.items - ) - } - - public func resolveParent(templates: Templates) throws -> DivSelectionInputTemplate { - let merged = try mergedWithParent(templates: templates) - - return DivSelectionInputTemplate( - parent: nil, - items: try merged.items?.resolveParent(templates: templates) - ) - } -} diff --git a/DivKit/generated_sources/DivSeparator.swift b/DivKit/generated_sources/DivSeparator.swift index 75033191..0762c028 100644 --- a/DivKit/generated_sources/DivSeparator.swift +++ b/DivKit/generated_sources/DivSeparator.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSeparatorTemplate.swift b/DivKit/generated_sources/DivSeparatorTemplate.swift index 8a6b5716..fce0c591 100644 --- a/DivKit/generated_sources/DivSeparatorTemplate.swift +++ b/DivKit/generated_sources/DivSeparatorTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShadow.swift b/DivKit/generated_sources/DivShadow.swift index 08a42cde..e9cbf8dd 100644 --- a/DivKit/generated_sources/DivShadow.swift +++ b/DivKit/generated_sources/DivShadow.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShadowTemplate.swift b/DivKit/generated_sources/DivShadowTemplate.swift index a2d15338..abe471f0 100644 --- a/DivKit/generated_sources/DivShadowTemplate.swift +++ b/DivKit/generated_sources/DivShadowTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShape.swift b/DivKit/generated_sources/DivShape.swift index 8338d5cb..068de61d 100644 --- a/DivKit/generated_sources/DivShape.swift +++ b/DivKit/generated_sources/DivShape.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShapeDrawable.swift b/DivKit/generated_sources/DivShapeDrawable.swift index 5bbc909f..1c42e96b 100644 --- a/DivKit/generated_sources/DivShapeDrawable.swift +++ b/DivKit/generated_sources/DivShapeDrawable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShapeDrawableTemplate.swift b/DivKit/generated_sources/DivShapeDrawableTemplate.swift index fe3b0d91..3c532d9b 100644 --- a/DivKit/generated_sources/DivShapeDrawableTemplate.swift +++ b/DivKit/generated_sources/DivShapeDrawableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivShapeTemplate.swift b/DivKit/generated_sources/DivShapeTemplate.swift index 4c21d198..f88c8a2e 100644 --- a/DivKit/generated_sources/DivShapeTemplate.swift +++ b/DivKit/generated_sources/DivShapeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSize.swift b/DivKit/generated_sources/DivSize.swift index 9db16d13..f2277b5b 100644 --- a/DivKit/generated_sources/DivSize.swift +++ b/DivKit/generated_sources/DivSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSizeTemplate.swift b/DivKit/generated_sources/DivSizeTemplate.swift index 4e2a8cb8..da86c112 100644 --- a/DivKit/generated_sources/DivSizeTemplate.swift +++ b/DivKit/generated_sources/DivSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSizeUnit.swift b/DivKit/generated_sources/DivSizeUnit.swift index 5d6481e6..6b469e62 100644 --- a/DivKit/generated_sources/DivSizeUnit.swift +++ b/DivKit/generated_sources/DivSizeUnit.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSlideTransition.swift b/DivKit/generated_sources/DivSlideTransition.swift index acadc3e0..da1a9e16 100644 --- a/DivKit/generated_sources/DivSlideTransition.swift +++ b/DivKit/generated_sources/DivSlideTransition.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSlideTransitionTemplate.swift b/DivKit/generated_sources/DivSlideTransitionTemplate.swift index a41265b5..948196ce 100644 --- a/DivKit/generated_sources/DivSlideTransitionTemplate.swift +++ b/DivKit/generated_sources/DivSlideTransitionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSlider.swift b/DivKit/generated_sources/DivSlider.swift index 9744e11f..8b9590bf 100644 --- a/DivKit/generated_sources/DivSlider.swift +++ b/DivKit/generated_sources/DivSlider.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSliderTemplate.swift b/DivKit/generated_sources/DivSliderTemplate.swift index e65c0187..35aaff6b 100644 --- a/DivKit/generated_sources/DivSliderTemplate.swift +++ b/DivKit/generated_sources/DivSliderTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSolidBackground.swift b/DivKit/generated_sources/DivSolidBackground.swift index c20466e6..d2cab36e 100644 --- a/DivKit/generated_sources/DivSolidBackground.swift +++ b/DivKit/generated_sources/DivSolidBackground.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivSolidBackgroundTemplate.swift b/DivKit/generated_sources/DivSolidBackgroundTemplate.swift index 448d5583..c604aaf5 100644 --- a/DivKit/generated_sources/DivSolidBackgroundTemplate.swift +++ b/DivKit/generated_sources/DivSolidBackgroundTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivState.swift b/DivKit/generated_sources/DivState.swift index 11667a4e..5c65e0f4 100644 --- a/DivKit/generated_sources/DivState.swift +++ b/DivKit/generated_sources/DivState.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivStateTemplate.swift b/DivKit/generated_sources/DivStateTemplate.swift index a78ef545..12c32c9b 100644 --- a/DivKit/generated_sources/DivStateTemplate.swift +++ b/DivKit/generated_sources/DivStateTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivStretchIndicatorItemPlacement.swift b/DivKit/generated_sources/DivStretchIndicatorItemPlacement.swift index 70498f1a..ecc5d74b 100644 --- a/DivKit/generated_sources/DivStretchIndicatorItemPlacement.swift +++ b/DivKit/generated_sources/DivStretchIndicatorItemPlacement.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivStretchIndicatorItemPlacementTemplate.swift b/DivKit/generated_sources/DivStretchIndicatorItemPlacementTemplate.swift index b068e941..374c096b 100644 --- a/DivKit/generated_sources/DivStretchIndicatorItemPlacementTemplate.swift +++ b/DivKit/generated_sources/DivStretchIndicatorItemPlacementTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivStroke.swift b/DivKit/generated_sources/DivStroke.swift index a5e7b2ba..36905e72 100644 --- a/DivKit/generated_sources/DivStroke.swift +++ b/DivKit/generated_sources/DivStroke.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivStrokeTemplate.swift b/DivKit/generated_sources/DivStrokeTemplate.swift index f80a30b9..53d22a42 100644 --- a/DivKit/generated_sources/DivStrokeTemplate.swift +++ b/DivKit/generated_sources/DivStrokeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTabs.swift b/DivKit/generated_sources/DivTabs.swift index c7c9836b..782fa453 100644 --- a/DivKit/generated_sources/DivTabs.swift +++ b/DivKit/generated_sources/DivTabs.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTabsTemplate.swift b/DivKit/generated_sources/DivTabsTemplate.swift index 5b593a26..b47671e8 100644 --- a/DivKit/generated_sources/DivTabsTemplate.swift +++ b/DivKit/generated_sources/DivTabsTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTemplate.swift b/DivKit/generated_sources/DivTemplate.swift index 2883b373..8a0b96ea 100644 --- a/DivKit/generated_sources/DivTemplate.swift +++ b/DivKit/generated_sources/DivTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivText.swift b/DivKit/generated_sources/DivText.swift index 72e6a408..890f9d97 100644 --- a/DivKit/generated_sources/DivText.swift +++ b/DivKit/generated_sources/DivText.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextGradient.swift b/DivKit/generated_sources/DivTextGradient.swift index b9f6567f..28db84f1 100644 --- a/DivKit/generated_sources/DivTextGradient.swift +++ b/DivKit/generated_sources/DivTextGradient.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextGradientTemplate.swift b/DivKit/generated_sources/DivTextGradientTemplate.swift index 00a4e963..e2a1dc27 100644 --- a/DivKit/generated_sources/DivTextGradientTemplate.swift +++ b/DivKit/generated_sources/DivTextGradientTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextRangeBackground.swift b/DivKit/generated_sources/DivTextRangeBackground.swift index 1d5c6146..59bbed56 100644 --- a/DivKit/generated_sources/DivTextRangeBackground.swift +++ b/DivKit/generated_sources/DivTextRangeBackground.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift b/DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift index 60352397..709a170b 100644 --- a/DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift +++ b/DivKit/generated_sources/DivTextRangeBackgroundTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextRangeBorder.swift b/DivKit/generated_sources/DivTextRangeBorder.swift index 77382739..1976e86f 100644 --- a/DivKit/generated_sources/DivTextRangeBorder.swift +++ b/DivKit/generated_sources/DivTextRangeBorder.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextRangeBorderTemplate.swift b/DivKit/generated_sources/DivTextRangeBorderTemplate.swift index 9c14dbc7..4f28cac7 100644 --- a/DivKit/generated_sources/DivTextRangeBorderTemplate.swift +++ b/DivKit/generated_sources/DivTextRangeBorderTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTextTemplate.swift b/DivKit/generated_sources/DivTextTemplate.swift index 52b0b26e..ca289436 100644 --- a/DivKit/generated_sources/DivTextTemplate.swift +++ b/DivKit/generated_sources/DivTextTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTimer.swift b/DivKit/generated_sources/DivTimer.swift index 5aee0cdf..76588310 100644 --- a/DivKit/generated_sources/DivTimer.swift +++ b/DivKit/generated_sources/DivTimer.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTimerTemplate.swift b/DivKit/generated_sources/DivTimerTemplate.swift index 16b6f664..a98d6358 100644 --- a/DivKit/generated_sources/DivTimerTemplate.swift +++ b/DivKit/generated_sources/DivTimerTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTooltip.swift b/DivKit/generated_sources/DivTooltip.swift index a4f9920d..323486ae 100644 --- a/DivKit/generated_sources/DivTooltip.swift +++ b/DivKit/generated_sources/DivTooltip.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTooltipTemplate.swift b/DivKit/generated_sources/DivTooltipTemplate.swift index 94005bb3..bbbb7454 100644 --- a/DivKit/generated_sources/DivTooltipTemplate.swift +++ b/DivKit/generated_sources/DivTooltipTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTransform.swift b/DivKit/generated_sources/DivTransform.swift index bc593967..55deb5bf 100644 --- a/DivKit/generated_sources/DivTransform.swift +++ b/DivKit/generated_sources/DivTransform.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTransformTemplate.swift b/DivKit/generated_sources/DivTransformTemplate.swift index 0aecf230..ab121d60 100644 --- a/DivKit/generated_sources/DivTransformTemplate.swift +++ b/DivKit/generated_sources/DivTransformTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTransitionBase.swift b/DivKit/generated_sources/DivTransitionBase.swift index 3525250d..b93dd46e 100644 --- a/DivKit/generated_sources/DivTransitionBase.swift +++ b/DivKit/generated_sources/DivTransitionBase.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTransitionSelector.swift b/DivKit/generated_sources/DivTransitionSelector.swift index bfc2b43a..6906e4e4 100644 --- a/DivKit/generated_sources/DivTransitionSelector.swift +++ b/DivKit/generated_sources/DivTransitionSelector.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTransitionTrigger.swift b/DivKit/generated_sources/DivTransitionTrigger.swift index 0319c2f0..4c10ab8b 100644 --- a/DivKit/generated_sources/DivTransitionTrigger.swift +++ b/DivKit/generated_sources/DivTransitionTrigger.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTrigger.swift b/DivKit/generated_sources/DivTrigger.swift index 93cc5bb8..37b157a0 100644 --- a/DivKit/generated_sources/DivTrigger.swift +++ b/DivKit/generated_sources/DivTrigger.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivTriggerTemplate.swift b/DivKit/generated_sources/DivTriggerTemplate.swift index 75e1fc0a..d2a6f03d 100644 --- a/DivKit/generated_sources/DivTriggerTemplate.swift +++ b/DivKit/generated_sources/DivTriggerTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivVariable.swift b/DivKit/generated_sources/DivVariable.swift index 133467ec..e2d3f565 100644 --- a/DivKit/generated_sources/DivVariable.swift +++ b/DivKit/generated_sources/DivVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivVariableTemplate.swift b/DivKit/generated_sources/DivVariableTemplate.swift index b4051fba..18ce6f88 100644 --- a/DivKit/generated_sources/DivVariableTemplate.swift +++ b/DivKit/generated_sources/DivVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivVisibility.swift b/DivKit/generated_sources/DivVisibility.swift index 92373782..22f38b0d 100644 --- a/DivKit/generated_sources/DivVisibility.swift +++ b/DivKit/generated_sources/DivVisibility.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivVisibilityAction.swift b/DivKit/generated_sources/DivVisibilityAction.swift index 597c4790..637a3850 100644 --- a/DivKit/generated_sources/DivVisibilityAction.swift +++ b/DivKit/generated_sources/DivVisibilityAction.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivVisibilityActionTemplate.swift b/DivKit/generated_sources/DivVisibilityActionTemplate.swift index 067b57ee..c3e8afc7 100644 --- a/DivKit/generated_sources/DivVisibilityActionTemplate.swift +++ b/DivKit/generated_sources/DivVisibilityActionTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivWrapContentSize.swift b/DivKit/generated_sources/DivWrapContentSize.swift index 851c70b9..4ab9268a 100644 --- a/DivKit/generated_sources/DivWrapContentSize.swift +++ b/DivKit/generated_sources/DivWrapContentSize.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/DivWrapContentSizeTemplate.swift b/DivKit/generated_sources/DivWrapContentSizeTemplate.swift index 6b2b5c75..3246e698 100644 --- a/DivKit/generated_sources/DivWrapContentSizeTemplate.swift +++ b/DivKit/generated_sources/DivWrapContentSizeTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/IntegerVariable.swift b/DivKit/generated_sources/IntegerVariable.swift index 26fd3968..2f071196 100644 --- a/DivKit/generated_sources/IntegerVariable.swift +++ b/DivKit/generated_sources/IntegerVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/IntegerVariableTemplate.swift b/DivKit/generated_sources/IntegerVariableTemplate.swift index b24e066d..f518652a 100644 --- a/DivKit/generated_sources/IntegerVariableTemplate.swift +++ b/DivKit/generated_sources/IntegerVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/NumberVariable.swift b/DivKit/generated_sources/NumberVariable.swift index 339101e7..207ad18c 100644 --- a/DivKit/generated_sources/NumberVariable.swift +++ b/DivKit/generated_sources/NumberVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/NumberVariableTemplate.swift b/DivKit/generated_sources/NumberVariableTemplate.swift index fd406673..35c23946 100644 --- a/DivKit/generated_sources/NumberVariableTemplate.swift +++ b/DivKit/generated_sources/NumberVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/StringVariable.swift b/DivKit/generated_sources/StringVariable.swift index 71928986..8871a34c 100644 --- a/DivKit/generated_sources/StringVariable.swift +++ b/DivKit/generated_sources/StringVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/StringVariableTemplate.swift b/DivKit/generated_sources/StringVariableTemplate.swift index e40bde69..3e024270 100644 --- a/DivKit/generated_sources/StringVariableTemplate.swift +++ b/DivKit/generated_sources/StringVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/UrlVariable.swift b/DivKit/generated_sources/UrlVariable.swift index cb1475eb..bf861a2e 100644 --- a/DivKit/generated_sources/UrlVariable.swift +++ b/DivKit/generated_sources/UrlVariable.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKit/generated_sources/UrlVariableTemplate.swift b/DivKit/generated_sources/UrlVariableTemplate.swift index 8c41e5fa..4f0b3901 100644 --- a/DivKit/generated_sources/UrlVariableTemplate.swift +++ b/DivKit/generated_sources/UrlVariableTemplate.swift @@ -1,6 +1,6 @@ // Generated code. Do not modify. -import CommonCore +import CommonCorePublic import Foundation import Serialization import TemplatesSupport diff --git a/DivKitExtensions/Animations/AnimatableView.swift b/DivKitExtensions/Animations/AnimatableView.swift index bba84e04..29fe6206 100644 --- a/DivKitExtensions/Animations/AnimatableView.swift +++ b/DivKitExtensions/Animations/AnimatableView.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import LayoutKit public protocol AnimatableViewFactory: AnyObject { diff --git a/DivKitExtensions/Animations/AnimationBlockView+UIViewRenderableBlock.swift b/DivKitExtensions/Animations/AnimationBlockView+UIViewRenderableBlock.swift index eb32ed05..3fbd548d 100644 --- a/DivKitExtensions/Animations/AnimationBlockView+UIViewRenderableBlock.swift +++ b/DivKitExtensions/Animations/AnimationBlockView+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import AVFoundation import UIKit -import CommonCore +import CommonCorePublic import LayoutKit extension LottieAnimationBlock { diff --git a/DivKitExtensions/Animations/AnimationBlockView.swift b/DivKitExtensions/Animations/AnimationBlockView.swift index 66e1b21f..8a915e12 100644 --- a/DivKitExtensions/Animations/AnimationBlockView.swift +++ b/DivKitExtensions/Animations/AnimationBlockView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKit final class AnimationBlockView: BlockView { diff --git a/DivKitExtensions/Animations/AnimationHolder.swift b/DivKitExtensions/Animations/AnimationHolder.swift index 50a050d1..a77e158c 100644 --- a/DivKitExtensions/Animations/AnimationHolder.swift +++ b/DivKitExtensions/Animations/AnimationHolder.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import LayoutKit public protocol AnimationHolder: AnyObject, CustomDebugStringConvertible { diff --git a/DivKitExtensions/Animations/Lottie/LottieAnimationBlock.swift b/DivKitExtensions/Animations/Lottie/LottieAnimationBlock.swift index 1da5d88d..e1f97cf1 100644 --- a/DivKitExtensions/Animations/Lottie/LottieAnimationBlock.swift +++ b/DivKitExtensions/Animations/Lottie/LottieAnimationBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import Base -import CommonCore +import BasePublic +import CommonCorePublic import LayoutKit final class LottieAnimationBlock: SizeForwardingBlock { diff --git a/DivKitExtensions/Animations/Lottie/LottieExtensionHandler.swift b/DivKitExtensions/Animations/Lottie/LottieExtensionHandler.swift index 38fba34d..d25d0b2b 100644 --- a/DivKitExtensions/Animations/Lottie/LottieExtensionHandler.swift +++ b/DivKitExtensions/Animations/Lottie/LottieExtensionHandler.swift @@ -1,9 +1,9 @@ -import Base +import BasePublic import DivKit import Foundation import LayoutKit import Network -import Networking +import NetworkingPublic public final class LottieExtensionHandler: DivExtensionHandler { public let id = "lottie" diff --git a/DivKitExtensions/Animations/RemoteAnimationHolder.swift b/DivKitExtensions/Animations/RemoteAnimationHolder.swift index c40f03dc..0a48728d 100644 --- a/DivKitExtensions/Animations/RemoteAnimationHolder.swift +++ b/DivKitExtensions/Animations/RemoteAnimationHolder.swift @@ -1,7 +1,7 @@ import Foundation -import Base -import Networking +import BasePublic +import NetworkingPublic public final class RemoteAnimationHolder: AnimationHolder { public enum AnimationType { diff --git a/DivKitExtensions/Animations/Rive/RiveAnimationBlock+UIViewRenderableBlock.swift b/DivKitExtensions/Animations/Rive/RiveAnimationBlock+UIViewRenderableBlock.swift index 9abfc7ae..d794a0ad 100644 --- a/DivKitExtensions/Animations/Rive/RiveAnimationBlock+UIViewRenderableBlock.swift +++ b/DivKitExtensions/Animations/Rive/RiveAnimationBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit extension RiveAnimationBlock { diff --git a/DivKitExtensions/Animations/Rive/RiveAnimationBlock.swift b/DivKitExtensions/Animations/Rive/RiveAnimationBlock.swift index 0fdb3140..a694be36 100644 --- a/DivKitExtensions/Animations/Rive/RiveAnimationBlock.swift +++ b/DivKitExtensions/Animations/Rive/RiveAnimationBlock.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKit public final class RiveAnimationBlock: BlockWithTraits { diff --git a/DivKitExtensions/ExtensionHandlers/CustomImagePreviewExtensionHandler.swift b/DivKitExtensions/ExtensionHandlers/CustomImagePreviewExtensionHandler.swift index 711673f2..4f4e41e5 100644 --- a/DivKitExtensions/ExtensionHandlers/CustomImagePreviewExtensionHandler.swift +++ b/DivKitExtensions/ExtensionHandlers/CustomImagePreviewExtensionHandler.swift @@ -1,6 +1,6 @@ import Foundation -import Base +import BasePublic import DivKit import LayoutKit diff --git a/DivKitExtensions/ExtensionHandlers/ImageExtensionHandler.swift b/DivKitExtensions/ExtensionHandlers/ImageExtensionHandler.swift index c3a1d57b..59516e19 100644 --- a/DivKitExtensions/ExtensionHandlers/ImageExtensionHandler.swift +++ b/DivKitExtensions/ExtensionHandlers/ImageExtensionHandler.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import DivKit import LayoutKit diff --git a/DivKitExtensions/ExtensionHandlers/ImageThemeExtensionHandler.swift b/DivKitExtensions/ExtensionHandlers/ImageThemeExtensionHandler.swift index fd636f8f..a9d89866 100644 --- a/DivKitExtensions/ExtensionHandlers/ImageThemeExtensionHandler.swift +++ b/DivKitExtensions/ExtensionHandlers/ImageThemeExtensionHandler.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import DivKit import LayoutKit diff --git a/DivKitExtensions/ExtensionHandlers/TextExtensionHandler.swift b/DivKitExtensions/ExtensionHandlers/TextExtensionHandler.swift index cd2dc18b..8ae7ed8f 100644 --- a/DivKitExtensions/ExtensionHandlers/TextExtensionHandler.swift +++ b/DivKitExtensions/ExtensionHandlers/TextExtensionHandler.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import DivKit import LayoutKit diff --git a/DivKitExtensions/Shimmer/ShimmerImagePreviewExtensions.swift b/DivKitExtensions/Shimmer/ShimmerImagePreviewExtensions.swift index 1da5e4e5..ad2e7e85 100644 --- a/DivKitExtensions/Shimmer/ShimmerImagePreviewExtensions.swift +++ b/DivKitExtensions/Shimmer/ShimmerImagePreviewExtensions.swift @@ -3,7 +3,7 @@ import UIKit import DivKit import LayoutKit -import Base +import BasePublic public final class ShimmerImagePreviewExtension: DivExtensionHandler { public let id: String = extensionID diff --git a/DivKitExtensions/Shimmer/ShimmerStyle.swift b/DivKitExtensions/Shimmer/ShimmerStyle.swift index c0f7c2cd..39555374 100644 --- a/DivKitExtensions/Shimmer/ShimmerStyle.swift +++ b/DivKitExtensions/Shimmer/ShimmerStyle.swift @@ -1,6 +1,6 @@ import Foundation import UIKit -import BaseTiny +import BaseTinyPublic import Serialization diff --git a/DivKitExtensions/SizeProvider/SizeProviderBlock+UIViewRenderable.swift b/DivKitExtensions/SizeProvider/SizeProviderBlock+UIViewRenderable.swift index add6f2e1..0c5d0d6b 100644 --- a/DivKitExtensions/SizeProvider/SizeProviderBlock+UIViewRenderable.swift +++ b/DivKitExtensions/SizeProvider/SizeProviderBlock+UIViewRenderable.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKit extension SizeProviderBlock { diff --git a/DivKitExtensions/SizeProvider/SizeProviderExtensionHandler.swift b/DivKitExtensions/SizeProvider/SizeProviderExtensionHandler.swift index 7b4235b9..2b30ff6e 100644 --- a/DivKitExtensions/SizeProvider/SizeProviderExtensionHandler.swift +++ b/DivKitExtensions/SizeProvider/SizeProviderExtensionHandler.swift @@ -1,4 +1,4 @@ -import Base +import BasePublic import DivKit import LayoutKit import Serialization diff --git a/LayoutKit/Interface/CommonHandler.swift b/LayoutKit/Interface/CommonHandler.swift index c55a438f..1ce6c259 100644 --- a/LayoutKit/Interface/CommonHandler.swift +++ b/LayoutKit/Interface/CommonHandler.swift @@ -1,4 +1,4 @@ -import BaseTiny +import BaseTinyPublic @frozen public enum CommonHandler { diff --git a/LayoutKit/Interface/UIElementPath.swift b/LayoutKit/Interface/UIElementPath.swift index db6961de..dd238162 100644 --- a/LayoutKit/Interface/UIElementPath.swift +++ b/LayoutKit/Interface/UIElementPath.swift @@ -1,6 +1,6 @@ import Foundation -import BaseTiny +import BaseTinyPublic public struct UIElementPath: CustomStringConvertible, Hashable, ExpressibleByStringLiteral, Codable { diff --git a/LayoutKit/Interface/UserInterfaceAction.swift b/LayoutKit/Interface/UserInterfaceAction.swift index 11afefb4..814e33e3 100644 --- a/LayoutKit/Interface/UserInterfaceAction.swift +++ b/LayoutKit/Interface/UserInterfaceAction.swift @@ -1,7 +1,7 @@ import Foundation -import BaseTiny -import BaseUI +import BaseTinyPublic +import BaseUIPublic public struct UserInterfaceAction: Equatable, Codable { @frozen diff --git a/LayoutKit/LayoutKit/Base/UILink.swift b/LayoutKit/LayoutKit/Base/UILink.swift index c87f508a..e7783cf0 100644 --- a/LayoutKit/LayoutKit/Base/UILink.swift +++ b/LayoutKit/LayoutKit/Base/UILink.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface public struct UILink: Equatable { diff --git a/LayoutKit/LayoutKit/Binding.swift b/LayoutKit/LayoutKit/Binding.swift index f95808f1..aad08fc0 100644 --- a/LayoutKit/LayoutKit/Binding.swift +++ b/LayoutKit/LayoutKit/Binding.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic #if os(iOS) import UIKit @@ -47,9 +47,3 @@ public struct Binding { self.userInterfaceActionFactory = userInterfaceActionFactory } } - -extension Binding where T == String { - public static var empty: Self { - .init(name: "", getValue: { _ in "" }, userInterfaceActionFactory: { _, _ in nil }) - } -} diff --git a/LayoutKit/LayoutKit/Blocks/AccessibilityContaining.swift b/LayoutKit/LayoutKit/Blocks/AccessibilityContaining.swift index 7d1413bc..1f55b9c4 100644 --- a/LayoutKit/LayoutKit/Blocks/AccessibilityContaining.swift +++ b/LayoutKit/LayoutKit/Blocks/AccessibilityContaining.swift @@ -1,4 +1,4 @@ -import BaseUI +import BaseUIPublic public protocol AccessibilityContaining { var accessibilityElement: AccessibilityElement? { get } diff --git a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock+UIViewRenderable.swift b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock+UIViewRenderable.swift index 11916163..cc81a32f 100644 --- a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock+UIViewRenderable.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension AnchorBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock.swift b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock.swift index 97256dbb..51bbf6ef 100644 --- a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class AnchorBlock: BlockWithLayout, BlockWithTraits { public struct Layout: Equatable { diff --git a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlockLayout.swift b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlockLayout.swift index 3872ab42..55563568 100644 --- a/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlockLayout.swift +++ b/LayoutKit/LayoutKit/Blocks/Anchor/AnchorBlockLayout.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension AnchorBlock.Layout { init( diff --git a/LayoutKit/LayoutKit/Blocks/AnimatableImageBlock.swift b/LayoutKit/LayoutKit/Blocks/AnimatableImageBlock.swift index f5144005..d11ec00f 100644 --- a/LayoutKit/LayoutKit/Blocks/AnimatableImageBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/AnimatableImageBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public final class AnimatableImageBlock: ImageBaseBlock { public let imageHolder: ImageHolder diff --git a/LayoutKit/LayoutKit/Blocks/Aspect/AspectBlock+UIViewRenderable.swift b/LayoutKit/LayoutKit/Blocks/Aspect/AspectBlock+UIViewRenderable.swift index 1043ffd7..4719e917 100644 --- a/LayoutKit/LayoutKit/Blocks/Aspect/AspectBlock+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/Blocks/Aspect/AspectBlock+UIViewRenderable.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic extension AspectBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/Blocks/BackgroundBlock.swift b/LayoutKit/LayoutKit/Blocks/BackgroundBlock.swift index 3dec3803..2eb0b99f 100644 --- a/LayoutKit/LayoutKit/Blocks/BackgroundBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/BackgroundBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class BackgroundBlock: BlockWithLayout, WrapperBlock { typealias Layout = CGRect diff --git a/LayoutKit/LayoutKit/Blocks/Block+Accessibility.swift b/LayoutKit/LayoutKit/Blocks/Block+Accessibility.swift index 078f560d..ad4382b1 100644 --- a/LayoutKit/LayoutKit/Blocks/Block+Accessibility.swift +++ b/LayoutKit/LayoutKit/Blocks/Block+Accessibility.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import BaseUI +import BaseUIPublic extension Block { public func addingAccessibilityID(_ id: @autoclosure () -> String?) -> Block { diff --git a/LayoutKit/LayoutKit/Blocks/Block+Debugging.swift b/LayoutKit/LayoutKit/Blocks/Block+Debugging.swift index 67031277..4af5aa51 100644 --- a/LayoutKit/LayoutKit/Blocks/Block+Debugging.swift +++ b/LayoutKit/LayoutKit/Blocks/Block+Debugging.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic extension ContainerBlock.LayoutDirection: CustomDebugStringConvertible { public var debugDescription: String { diff --git a/LayoutKit/LayoutKit/Blocks/Block.swift b/LayoutKit/LayoutKit/Blocks/Block.swift index bd27451b..ea30ffba 100644 --- a/LayoutKit/LayoutKit/Blocks/Block.swift +++ b/LayoutKit/LayoutKit/Blocks/Block.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic #if os(iOS) public typealias BlockRenderingImpl = UIViewRenderable diff --git a/LayoutKit/LayoutKit/Blocks/BlockAlignment2D.swift b/LayoutKit/LayoutKit/Blocks/BlockAlignment2D.swift index 666e75cb..07f21c78 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockAlignment2D.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockAlignment2D.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct BlockAlignment2D: Equatable { public let horizontal: Alignment diff --git a/LayoutKit/LayoutKit/Blocks/BlockBorder.swift b/LayoutKit/LayoutKit/Blocks/BlockBorder.swift index a9a3e674..e9c62650 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockBorder.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockBorder.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public struct BlockBorder: Equatable { public let color: Color diff --git a/LayoutKit/LayoutKit/Blocks/BlockError.swift b/LayoutKit/LayoutKit/Blocks/BlockError.swift index 183afdaf..e687c32d 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockError.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockError.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public protocol BlockError: Error { var errorMessage: NonEmptyString { get } diff --git a/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift b/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift index 8b04508e..22756799 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockTooltip+Layout.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension BlockTooltip { public func calculateFrame(targeting targetRect: CGRect) -> CGRect { diff --git a/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift b/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift index feaa1400..136750f3 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockTooltip.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct BlockTooltip: Equatable { public enum Position: String, CaseIterable { diff --git a/LayoutKit/LayoutKit/Blocks/BlockWithLayout.swift b/LayoutKit/LayoutKit/Blocks/BlockWithLayout.swift index c0054987..053499a1 100644 --- a/LayoutKit/LayoutKit/Blocks/BlockWithLayout.swift +++ b/LayoutKit/LayoutKit/Blocks/BlockWithLayout.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic #if os(iOS) import UIKit diff --git a/LayoutKit/LayoutKit/Blocks/BlocksStateExtensions.swift b/LayoutKit/LayoutKit/Blocks/BlocksStateExtensions.swift index 00fa2656..3937ab17 100644 --- a/LayoutKit/LayoutKit/Blocks/BlocksStateExtensions.swift +++ b/LayoutKit/LayoutKit/Blocks/BlocksStateExtensions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface extension BlocksState { diff --git a/LayoutKit/LayoutKit/Blocks/BoundaryTrait+CALayer.swift b/LayoutKit/LayoutKit/Blocks/BoundaryTrait+CALayer.swift index 1ec8bb5a..41b2239d 100644 --- a/LayoutKit/LayoutKit/Blocks/BoundaryTrait+CALayer.swift +++ b/LayoutKit/LayoutKit/Blocks/BoundaryTrait+CALayer.swift @@ -2,13 +2,9 @@ import QuartzCore extension CALayer { func apply(boundary: BoundaryTrait) { - if #available(iOS 11, *) { - let boundary = boundary.makeInfo(for: bounds.size) - cornerRadius = boundary.radius - maskedCorners = boundary.corners - mask = boundary.layer - } else { - mask = boundary.makeMaskLayer(for: bounds.size) - } + let boundary = boundary.makeInfo(for: bounds.size) + cornerRadius = boundary.radius + maskedCorners = boundary.corners + mask = boundary.layer } } diff --git a/LayoutKit/LayoutKit/Blocks/BoundaryTrait.swift b/LayoutKit/LayoutKit/Blocks/BoundaryTrait.swift index 2f8283d2..81b04e25 100644 --- a/LayoutKit/LayoutKit/Blocks/BoundaryTrait.swift +++ b/LayoutKit/LayoutKit/Blocks/BoundaryTrait.swift @@ -1,7 +1,7 @@ import CoreGraphics import QuartzCore -import CommonCore +import CommonCorePublic public enum BoundaryTrait: Equatable { case noClip diff --git a/LayoutKit/LayoutKit/Blocks/BoundaryTraitExtensions.swift b/LayoutKit/LayoutKit/Blocks/BoundaryTraitExtensions.swift index 7f5bd7c2..3354b28d 100644 --- a/LayoutKit/LayoutKit/Blocks/BoundaryTraitExtensions.swift +++ b/LayoutKit/LayoutKit/Blocks/BoundaryTraitExtensions.swift @@ -1,6 +1,6 @@ import QuartzCore -import CommonCore +import CommonCorePublic typealias BoundaryInfo = (radius: CGFloat, corners: CACornerMask, layer: CALayer?) diff --git a/LayoutKit/LayoutKit/Blocks/Container/ConstrainedBlockMeasure.swift b/LayoutKit/LayoutKit/Blocks/Container/ConstrainedBlockMeasure.swift index a70cad90..d9a7005b 100644 --- a/LayoutKit/LayoutKit/Blocks/Container/ConstrainedBlockMeasure.swift +++ b/LayoutKit/LayoutKit/Blocks/Container/ConstrainedBlockMeasure.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic struct ConstrainedBlockSize { var size: CGFloat diff --git a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlock.swift b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlock.swift index 2b9f2652..ad5653a7 100644 --- a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public final class ContainerBlock: BlockWithLayout { typealias Layout = ContainerBlockLayout diff --git a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockExtensions.swift b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockExtensions.swift index b95011f6..41f070e2 100644 --- a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockExtensions.swift +++ b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockExtensions.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic extension ContainerBlock { public func modifying( diff --git a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockLayout.swift b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockLayout.swift index 55fe2962..30ccc8e5 100644 --- a/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockLayout.swift +++ b/LayoutKit/LayoutKit/Blocks/Container/ContainerBlockLayout.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic struct ContainerBlockLayout { private enum ContentFitting { diff --git a/LayoutKit/LayoutKit/Blocks/Container/WrapLayoutGroups.swift b/LayoutKit/LayoutKit/Blocks/Container/WrapLayoutGroups.swift index 05fd3fe0..260b40fb 100644 --- a/LayoutKit/LayoutKit/Blocks/Container/WrapLayoutGroups.swift +++ b/LayoutKit/LayoutKit/Blocks/Container/WrapLayoutGroups.swift @@ -1,3 +1,4 @@ +import BaseTinyPublic import Foundation struct WrapLayoutGroups { @@ -41,7 +42,8 @@ struct WrapLayoutGroups { private mutating func makeGroups() { addStartLineSeparator() children.forEach { child in - guard !child.isResizable(for: layoutDirection.opposite) else { return } + guard !child.isResizable(for: layoutDirection.opposite) && !child + .isConstrained(for: layoutDirection.opposite) else { return } if child.isResizable(for: layoutDirection) { startNewLine() var childSize = child.content.size(forResizableBlockSize: size) @@ -57,13 +59,23 @@ struct WrapLayoutGroups { } addChild(child: child, size: childSize) } else { - let childSize = child.content.size(forResizableBlockSize: .zero) + let childSize = child.content.sizeFor( + widthOfHorizontallyResizableBlock: .zero, + heightOfVerticallyResizableBlock: .zero, + constrainedWidth: keyPath == \.width ? + size[keyPath: keyPath] : .infinity, + constrainedHeight: keyPath == \.height ? + size[keyPath: keyPath] : .infinity + ) if childSize.isEmpty { return } if offset + childSize[keyPath: keyPath] + separatorOffset > size[keyPath: keyPath] { startNewLine() - addChild(child: child, size: childSize) + addChild( + child: child, + size: childSize + ) } else { addChild(child: child, size: childSize) } @@ -206,4 +218,13 @@ extension ContainerBlock.Child { return content.isVerticallyResizable } } + + fileprivate func isConstrained(for layoutDirection: ContainerBlock.LayoutDirection) -> Bool { + switch layoutDirection { + case .horizontal: + return content.isHorizontallyConstrained + case .vertical: + return content.isVerticallyConstrained + } + } } diff --git a/LayoutKit/LayoutKit/Blocks/DebugInfoBlock.swift b/LayoutKit/LayoutKit/Blocks/DebugInfoBlock.swift index 2cba8f6b..3bf5f6bf 100644 --- a/LayoutKit/LayoutKit/Blocks/DebugInfoBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/DebugInfoBlock.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public final class DebugInfoBlock: WrapperBlock, LayoutCachingDefaultImpl { public static let showOverlayURL = URL(string: "debugInfo://show")! diff --git a/LayoutKit/LayoutKit/Blocks/Decorations/Block+Decorations.swift b/LayoutKit/LayoutKit/Blocks/Decorations/Block+Decorations.swift index 90b6d334..f628293d 100644 --- a/LayoutKit/LayoutKit/Blocks/Decorations/Block+Decorations.swift +++ b/LayoutKit/LayoutKit/Blocks/Decorations/Block+Decorations.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension Block { diff --git a/LayoutKit/LayoutKit/Blocks/Decorations/ContextMenu.swift b/LayoutKit/LayoutKit/Blocks/Decorations/ContextMenu.swift index 10be8726..7f7ced98 100644 --- a/LayoutKit/LayoutKit/Blocks/Decorations/ContextMenu.swift +++ b/LayoutKit/LayoutKit/Blocks/Decorations/ContextMenu.swift @@ -1,7 +1,7 @@ import Foundation -import Base -import CommonCore +import BasePublic +import CommonCorePublic import LayoutKitInterface public struct ContextMenu: Equatable { diff --git a/LayoutKit/LayoutKit/Blocks/Decorations/DecoratingBlock.swift b/LayoutKit/LayoutKit/Blocks/Decorations/DecoratingBlock.swift index d0cfd6f9..b245f6ab 100644 --- a/LayoutKit/LayoutKit/Blocks/Decorations/DecoratingBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Decorations/DecoratingBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface final class DecoratingBlock: WrapperBlock { diff --git a/LayoutKit/LayoutKit/Blocks/Decorations/LongTapActions.swift b/LayoutKit/LayoutKit/Blocks/Decorations/LongTapActions.swift index de5a87b4..e67d9721 100644 --- a/LayoutKit/LayoutKit/Blocks/Decorations/LongTapActions.swift +++ b/LayoutKit/LayoutKit/Blocks/Decorations/LongTapActions.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface public enum LongTapActions: Equatable { diff --git a/LayoutKit/LayoutKit/Blocks/DetachableAnimationBlock.swift b/LayoutKit/LayoutKit/Blocks/DetachableAnimationBlock.swift index 63eaf4c2..1f9f8b93 100644 --- a/LayoutKit/LayoutKit/Blocks/DetachableAnimationBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/DetachableAnimationBlock.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public struct ChangeBoundsTransition: Equatable { public let duration: Duration diff --git a/LayoutKit/LayoutKit/Blocks/EmptyBlock.swift b/LayoutKit/LayoutKit/Blocks/EmptyBlock.swift index f4acb581..b453bc75 100644 --- a/LayoutKit/LayoutKit/Blocks/EmptyBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/EmptyBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class EmptyBlock: BlockWithTraits { public let widthTrait: LayoutTrait diff --git a/LayoutKit/LayoutKit/Blocks/GalleryBlock.swift b/LayoutKit/LayoutKit/Blocks/GalleryBlock.swift index b72a5d2a..a168e27f 100644 --- a/LayoutKit/LayoutKit/Blocks/GalleryBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/GalleryBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface public final class GalleryBlock: BlockWithTraits { @@ -74,7 +74,7 @@ extension GalleryBlock { direction: GalleryViewModel.Direction, crossAlignment: Alignment, scrollMode: GalleryViewModel.ScrollMode = .default, - state: GalleryViewState = .default, + state: GalleryViewState? = nil, widthTrait: LayoutTrait? = nil, heightTrait: LayoutTrait? = nil, areEmptySpaceTouchesEnabled: Bool = true, @@ -95,7 +95,7 @@ extension GalleryBlock { try self.init( model: model, - state: state, + state: state ?? GalleryViewState(contentOffset: 0, itemsCount: children.count), widthTrait: widthTrait ?? (direction.isHorizontal ? .resizable : .intrinsic), heightTrait: heightTrait ?? (direction.isHorizontal ? .intrinsic : .resizable) ) @@ -122,7 +122,11 @@ extension GalleryBlock { direction: direction, crossAlignment: crossAlignment, scrollMode: scrollMode, - state: GalleryViewState(contentPosition: contentPosition, isScrolling: false), + state: GalleryViewState( + contentPosition: contentPosition, + itemsCount: children.count, + isScrolling: false + ), widthTrait: widthTrait, heightTrait: heightTrait, areEmptySpaceTouchesEnabled: areEmptySpaceTouchesEnabled, diff --git a/LayoutKit/LayoutKit/Blocks/GradientBlock.swift b/LayoutKit/LayoutKit/Blocks/GradientBlock.swift index 23513234..f0d9282a 100644 --- a/LayoutKit/LayoutKit/Blocks/GradientBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/GradientBlock.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public final class GradientBlock: BlockWithTraits { public let gradient: Gradient diff --git a/LayoutKit/LayoutKit/Blocks/Grid/Grid.swift b/LayoutKit/LayoutKit/Blocks/Grid/Grid.swift index b8873442..b43a681b 100644 --- a/LayoutKit/LayoutKit/Blocks/Grid/Grid.swift +++ b/LayoutKit/LayoutKit/Blocks/Grid/Grid.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic struct Grid { typealias GridItem = GridBlock.Item diff --git a/LayoutKit/LayoutKit/Blocks/Grid/GridBlock.swift b/LayoutKit/LayoutKit/Blocks/Grid/GridBlock.swift index 0a345b41..92b07001 100644 --- a/LayoutKit/LayoutKit/Blocks/Grid/GridBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Grid/GridBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic import LayoutKitInterface public final class GridBlock: BlockWithTraits, BlockWithLayout { diff --git a/LayoutKit/LayoutKit/Blocks/Grid/GridLayout.swift b/LayoutKit/LayoutKit/Blocks/Grid/GridLayout.swift index 76acda0f..6ec43ce2 100644 --- a/LayoutKit/LayoutKit/Blocks/Grid/GridLayout.swift +++ b/LayoutKit/LayoutKit/Blocks/Grid/GridLayout.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension GridBlock.Layout { init( diff --git a/LayoutKit/LayoutKit/Blocks/ImageBaseBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageBaseBlock.swift index 78afa80e..ddb36b9a 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageBaseBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageBaseBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public protocol ImageBaseBlock: BlockWithWidthTrait { var height: ImageBlockHeight { get } diff --git a/LayoutKit/LayoutKit/Blocks/ImageBlock+Copy.swift b/LayoutKit/LayoutKit/Blocks/ImageBlock+Copy.swift index 7a577921..89e16101 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageBlock+Copy.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageBlock+Copy.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic extension ImageBlock { public func makeCopy(with imageHolder: ImageHolder) -> ImageBlock { diff --git a/LayoutKit/LayoutKit/Blocks/ImageBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageBlock.swift index 8b6f6ac8..db873bb6 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public final class ImageBlock: ImageBaseBlock { public let imageHolder: ImageHolder diff --git a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ContainerBlock+ImageRenderableBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ContainerBlock+ImageRenderableBlock.swift index e1daf3d1..df77ac94 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ContainerBlock+ImageRenderableBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ContainerBlock+ImageRenderableBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic extension ContainerBlock: ImageRenderableBlock { public func drawInRect(_ rect: CGRect, context: CGContext) { diff --git a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageBlock+ImageRenderableBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageBlock+ImageRenderableBlock.swift index 2af60149..a9c32d92 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageBlock+ImageRenderableBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageBlock+ImageRenderableBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import BaseUI +import BaseUIPublic extension ImageBlock: ImageRenderableBlock { public func drawInRect(_ rect: CGRect, context: CGContext) { diff --git a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageRenderableBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageRenderableBlock.swift index 8e23750f..9735345f 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageRenderableBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/ImageRenderableBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public protocol ImageRenderableBlock: Block { func drawInRect(_ rect: CGRect, context: CGContext) diff --git a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/LayredBlock+ImageRenderableBlock.swift b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/LayredBlock+ImageRenderableBlock.swift index c8247db0..bb940a8d 100644 --- a/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/LayredBlock+ImageRenderableBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/ImageRenderableBlock/LayredBlock+ImageRenderableBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension LayeredBlock: ImageRenderableBlock { public func drawInRect(_ rect: CGRect, context: CGContext) { diff --git a/LayoutKit/LayoutKit/Blocks/LaidOutBlock.swift b/LayoutKit/LayoutKit/Blocks/LaidOutBlock.swift index d46b682c..e8e27890 100644 --- a/LayoutKit/LayoutKit/Blocks/LaidOutBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/LaidOutBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic final class LaidOutBlock: Block { public let block: T diff --git a/LayoutKit/LayoutKit/Blocks/LayeredBlock.swift b/LayoutKit/LayoutKit/Blocks/LayeredBlock.swift index c59157cb..3f619387 100644 --- a/LayoutKit/LayoutKit/Blocks/LayeredBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/LayeredBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class LayeredBlock: BlockWithTraits, BlockWithLayout { typealias Layout = [CGRect] diff --git a/LayoutKit/LayoutKit/Blocks/LayeredBlockLayout.swift b/LayoutKit/LayoutKit/Blocks/LayeredBlockLayout.swift index b6edb22b..63771f0a 100644 --- a/LayoutKit/LayoutKit/Blocks/LayeredBlockLayout.swift +++ b/LayoutKit/LayoutKit/Blocks/LayeredBlockLayout.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension LayeredBlock { func makeChildrenFrames(size: CGSize) -> [CGRect] { diff --git a/LayoutKit/LayoutKit/Blocks/MaskedBlock.swift b/LayoutKit/LayoutKit/Blocks/MaskedBlock.swift index 6613af2a..b09d57c2 100644 --- a/LayoutKit/LayoutKit/Blocks/MaskedBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/MaskedBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class MaskedBlock: SizeForwardingBlock { public let maskBlock: Block diff --git a/LayoutKit/LayoutKit/Blocks/PageControlBlock.swift b/LayoutKit/LayoutKit/Blocks/PageControlBlock.swift index c7898ab3..554fc0fe 100644 --- a/LayoutKit/LayoutKit/Blocks/PageControlBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/PageControlBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class PageControlBlock: BlockWithTraits { public typealias State = PagerViewState diff --git a/LayoutKit/LayoutKit/Blocks/PagerBlock.swift b/LayoutKit/LayoutKit/Blocks/PagerBlock.swift index 43b9e17f..6fd24bd4 100644 --- a/LayoutKit/LayoutKit/Blocks/PagerBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/PagerBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface public final class PagerBlock: BlockWithTraits { diff --git a/LayoutKit/LayoutKit/Blocks/PinchToZoomBlock.swift b/LayoutKit/LayoutKit/Blocks/PinchToZoomBlock.swift index d3384f67..5cdeddbc 100644 --- a/LayoutKit/LayoutKit/Blocks/PinchToZoomBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/PinchToZoomBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class PinchToZoomBlock: WrapperBlock, LayoutCachingDefaultImpl { public let child: Block diff --git a/LayoutKit/LayoutKit/Blocks/ResizableBlockMeasure.swift b/LayoutKit/LayoutKit/Blocks/ResizableBlockMeasure.swift index eda99281..427bfb2f 100644 --- a/LayoutKit/LayoutKit/Blocks/ResizableBlockMeasure.swift +++ b/LayoutKit/LayoutKit/Blocks/ResizableBlockMeasure.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct ResizableBlockMeasure { public enum Measure { diff --git a/LayoutKit/LayoutKit/Blocks/RoundedRect.swift b/LayoutKit/LayoutKit/Blocks/RoundedRect.swift index 772b5010..3198d8e2 100644 --- a/LayoutKit/LayoutKit/Blocks/RoundedRect.swift +++ b/LayoutKit/LayoutKit/Blocks/RoundedRect.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension CGPath { public static func roundedRect( diff --git a/LayoutKit/LayoutKit/Blocks/SeparatorBlock.swift b/LayoutKit/LayoutKit/Blocks/SeparatorBlock.swift index cf9871d8..f038c3c9 100644 --- a/LayoutKit/LayoutKit/Blocks/SeparatorBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/SeparatorBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class SeparatorBlock: BlockWithTraits { public enum Direction { diff --git a/LayoutKit/LayoutKit/Blocks/Shadow/BlockShadow.swift b/LayoutKit/LayoutKit/Blocks/Shadow/BlockShadow.swift index f7ace706..60ae04e0 100644 --- a/LayoutKit/LayoutKit/Blocks/Shadow/BlockShadow.swift +++ b/LayoutKit/LayoutKit/Blocks/Shadow/BlockShadow.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct BlockShadow: Equatable { public enum Defaults { diff --git a/LayoutKit/LayoutKit/Blocks/Shadow/ShadedBlock.swift b/LayoutKit/LayoutKit/Blocks/Shadow/ShadedBlock.swift index c5e19d7a..91945102 100644 --- a/LayoutKit/LayoutKit/Blocks/Shadow/ShadedBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Shadow/ShadedBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class ShadedBlock { public let block: Block diff --git a/LayoutKit/LayoutKit/Blocks/SizeForwardingBlock.swift b/LayoutKit/LayoutKit/Blocks/SizeForwardingBlock.swift index 48aca2c9..d1e8cbef 100644 --- a/LayoutKit/LayoutKit/Blocks/SizeForwardingBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/SizeForwardingBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public protocol SizeForwardingBlock: Block { var sizeProvider: Block { get } diff --git a/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock+UIViewRenderable.swift b/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock+UIViewRenderable.swift index ea8d58cb..8cc872aa 100644 --- a/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock+UIViewRenderable.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic extension SliderBlock: UIViewRenderable { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock.swift b/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock.swift index 89533675..4989a45b 100644 --- a/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/Slider/SliderBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class SliderBlock: BlockWithTraits { // MARK: - BlockWithTraits diff --git a/LayoutKit/LayoutKit/Blocks/Slider/SliderModel.swift b/LayoutKit/LayoutKit/Blocks/Slider/SliderModel.swift index 19ddd1de..baf71c73 100644 --- a/LayoutKit/LayoutKit/Blocks/Slider/SliderModel.swift +++ b/LayoutKit/LayoutKit/Blocks/Slider/SliderModel.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public struct SliderModel: Equatable { public struct ThumbModel: Equatable { diff --git a/LayoutKit/LayoutKit/Blocks/Slider/SliderView.swift b/LayoutKit/LayoutKit/Blocks/Slider/SliderView.swift index c8b0342f..fa9f7cb3 100644 --- a/LayoutKit/LayoutKit/Blocks/Slider/SliderView.swift +++ b/LayoutKit/LayoutKit/Blocks/Slider/SliderView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic final class SliderView: BlockView, VisibleBoundsTrackingLeaf { private var sliderModel: SliderModel = .empty diff --git a/LayoutKit/LayoutKit/Blocks/StateBlock.swift b/LayoutKit/LayoutKit/Blocks/StateBlock.swift index da3aedd6..f07b8e47 100644 --- a/LayoutKit/LayoutKit/Blocks/StateBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/StateBlock.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public final class StateBlock: WrapperBlock, LayoutCachingDefaultImpl { public let child: Block diff --git a/LayoutKit/LayoutKit/Blocks/SwitchBlock.swift b/LayoutKit/LayoutKit/Blocks/SwitchBlock.swift index 655db5d1..aa649f9d 100644 --- a/LayoutKit/LayoutKit/Blocks/SwitchBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/SwitchBlock.swift @@ -1,9 +1,9 @@ import CoreGraphics import Foundation -import Base -import BaseUI -import CommonCore +import BasePublic +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface public final class SwitchBlock: Block { diff --git a/LayoutKit/LayoutKit/Blocks/SwitchableContainerBlock.swift b/LayoutKit/LayoutKit/Blocks/SwitchableContainerBlock.swift index 53c0482e..9979e16f 100644 --- a/LayoutKit/LayoutKit/Blocks/SwitchableContainerBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/SwitchableContainerBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface public final class SwitchableContainerBlock: Block { diff --git a/LayoutKit/LayoutKit/Blocks/TabsBlock.swift b/LayoutKit/LayoutKit/Blocks/TabsBlock.swift index ed4c1903..f9cdcb01 100644 --- a/LayoutKit/LayoutKit/Blocks/TabsBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/TabsBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class TabsBlock: BlockWithTraits { public enum Error: NonEmptyString, BlockError { diff --git a/LayoutKit/LayoutKit/Blocks/TextBlock+Copy.swift b/LayoutKit/LayoutKit/Blocks/TextBlock+Copy.swift index 615cd31b..ef623dd7 100644 --- a/LayoutKit/LayoutKit/Blocks/TextBlock+Copy.swift +++ b/LayoutKit/LayoutKit/Blocks/TextBlock+Copy.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic extension TextBlock { public convenience init?(copyingAttributesFrom block: TextBlock, text: String) { diff --git a/LayoutKit/LayoutKit/Blocks/TextBlock.swift b/LayoutKit/LayoutKit/Blocks/TextBlock.swift index 1a344c0e..e06e4517 100644 --- a/LayoutKit/LayoutKit/Blocks/TextBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/TextBlock.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic @_implementationOnly import CoreText diff --git a/LayoutKit/LayoutKit/Blocks/TextFieldBlock+Debugging.swift b/LayoutKit/LayoutKit/Blocks/TextFieldBlock+Debugging.swift index afc241e5..11a9dfb0 100644 --- a/LayoutKit/LayoutKit/Blocks/TextFieldBlock+Debugging.swift +++ b/LayoutKit/LayoutKit/Blocks/TextFieldBlock+Debugging.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic extension TextFieldBlock: CustomDebugStringConvertible { public var debugDescription: String { diff --git a/LayoutKit/LayoutKit/Blocks/TextFieldBlock.swift b/LayoutKit/LayoutKit/Blocks/TextFieldBlock.swift index 0139d651..a1732b93 100644 --- a/LayoutKit/LayoutKit/Blocks/TextFieldBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/TextFieldBlock.swift @@ -1,9 +1,9 @@ import CoreGraphics import Foundation -import Base -import BaseUI -import CommonCore +import BasePublic +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface public final class TextFieldBlock: Block { diff --git a/LayoutKit/LayoutKit/Blocks/TextInputBlock+Debugging.swift b/LayoutKit/LayoutKit/Blocks/TextInputBlock+Debugging.swift index 2ff71ad6..da1d4775 100644 --- a/LayoutKit/LayoutKit/Blocks/TextInputBlock+Debugging.swift +++ b/LayoutKit/LayoutKit/Blocks/TextInputBlock+Debugging.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic extension TextInputBlock: CustomDebugStringConvertible { public var debugDescription: String { @@ -11,7 +11,7 @@ extension TextInputBlock: CustomDebugStringConvertible { result += "\n Variable text: \(textValue.wrappedValue)" - result += "\n Input type: \(inputType)" + result += "\n Keyboard type: \(keyboardType)" result += "\n}" diff --git a/LayoutKit/LayoutKit/Blocks/TextInputBlock.swift b/LayoutKit/LayoutKit/Blocks/TextInputBlock.swift index 3687e4a2..c470db99 100644 --- a/LayoutKit/LayoutKit/Blocks/TextInputBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/TextInputBlock.swift @@ -1,42 +1,25 @@ import CoreGraphics import Foundation -import Base -import BaseUI -import CommonCore +import BasePublic +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface public final class TextInputBlock: BlockWithTraits { - public enum InputType: Equatable { - public enum KeyboardType: Equatable { - case `default` - case asciiCapable - case numbersAndPunctuation - case URL - case numberPad - case phonePad - case namePhonePad - case emailAddress - case decimalPad - case twitter - case webSearch - case asciiCapableNumberPad - } - - public struct SelectionItem: Equatable { - public let value: String - public let text: String - - public init(value: String, text: String) { - self.value = value - self.text = text - } - } - - case keyboard(KeyboardType) - case selection([SelectionItem]) - - public static let `default`: Self = .keyboard(.default) + public enum KeyboardType { + case `default` + case asciiCapable + case numbersAndPunctuation + case URL + case numberPad + case phonePad + case namePhonePad + case emailAddress + case decimalPad + case twitter + case webSearch + case asciiCapableNumberPad } public let widthTrait: LayoutTrait @@ -45,7 +28,7 @@ public final class TextInputBlock: BlockWithTraits { public let textValue: Binding public let textTypo: Typo public let multiLineMode: Bool - public let inputType: InputType + public let keyboardType: KeyboardType public let highlightColor: Color? public let maxVisibleLines: Int? public let selectAllOnFocus: Bool @@ -61,7 +44,7 @@ public final class TextInputBlock: BlockWithTraits { textValue: Binding, textTypo: Typo, multiLineMode: Bool = true, - inputType: InputType = .default, + keyboardType: KeyboardType = .default, highlightColor: Color? = nil, maxVisibleLines: Int? = nil, selectAllOnFocus: Bool = false, @@ -76,7 +59,7 @@ public final class TextInputBlock: BlockWithTraits { self.textValue = textValue self.textTypo = textTypo self.multiLineMode = multiLineMode - self.inputType = inputType + self.keyboardType = keyboardType self.highlightColor = highlightColor self.maxVisibleLines = maxVisibleLines self.selectAllOnFocus = selectAllOnFocus @@ -148,7 +131,7 @@ extension TextInputBlock { && lhs.textValue.wrappedValue == rhs.textValue.wrappedValue && lhs.multiLineMode == rhs.multiLineMode && lhs.maxVisibleLines == rhs.maxVisibleLines - && lhs.inputType == rhs.inputType + && lhs.keyboardType == rhs.keyboardType && lhs.selectAllOnFocus == rhs.selectAllOnFocus && lhs.highlightColor == rhs.highlightColor } diff --git a/LayoutKit/LayoutKit/Blocks/TransitioningAnimation.swift b/LayoutKit/LayoutKit/Blocks/TransitioningAnimation.swift index 0f184c8b..d1a10e63 100644 --- a/LayoutKit/LayoutKit/Blocks/TransitioningAnimation.swift +++ b/LayoutKit/LayoutKit/Blocks/TransitioningAnimation.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct TransitioningAnimation: Equatable { @frozen diff --git a/LayoutKit/LayoutKit/Blocks/TransitioningBlock.swift b/LayoutKit/LayoutKit/Blocks/TransitioningBlock.swift index 22ce8494..6a032006 100644 --- a/LayoutKit/LayoutKit/Blocks/TransitioningBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/TransitioningBlock.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public final class TransitioningBlock: BlockWithLayout, WrapperBlock { public typealias Layout = CGRect diff --git a/LayoutKit/LayoutKit/Blocks/VideoBlock.swift b/LayoutKit/LayoutKit/Blocks/VideoBlock.swift index 426014d9..156007c2 100644 --- a/LayoutKit/LayoutKit/Blocks/VideoBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/VideoBlock.swift @@ -2,8 +2,8 @@ import AVFoundation import CoreGraphics import Foundation -import Base -import CommonCore +import BasePublic +import CommonCorePublic public final class VideoBlock: BlockWithTraits { public struct VideoAssetHolder { diff --git a/LayoutKit/LayoutKit/Blocks/VisibilityAction.swift b/LayoutKit/LayoutKit/Blocks/VisibilityAction.swift index c9960caf..b8ddfd7f 100644 --- a/LayoutKit/LayoutKit/Blocks/VisibilityAction.swift +++ b/LayoutKit/LayoutKit/Blocks/VisibilityAction.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import Base +import BasePublic import LayoutKitInterface public struct VisibilityAction { diff --git a/LayoutKit/LayoutKit/Blocks/WrapperBlock.swift b/LayoutKit/LayoutKit/Blocks/WrapperBlock.swift index 5de15e92..9259a2ba 100644 --- a/LayoutKit/LayoutKit/Blocks/WrapperBlock.swift +++ b/LayoutKit/LayoutKit/Blocks/WrapperBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public protocol WrapperBlock: SizeForwardingBlock { var child: Block { get } diff --git a/LayoutKit/LayoutKit/GenericViewBlock.swift b/LayoutKit/LayoutKit/GenericViewBlock.swift index a8075ac8..7ad7a6b5 100644 --- a/LayoutKit/LayoutKit/GenericViewBlock.swift +++ b/LayoutKit/LayoutKit/GenericViewBlock.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic #if os(iOS) import UIKit diff --git a/LayoutKit/LayoutKit/TooltipFactory.swift b/LayoutKit/LayoutKit/TooltipFactory.swift index d451d71d..17ebc910 100644 --- a/LayoutKit/LayoutKit/TooltipFactory.swift +++ b/LayoutKit/LayoutKit/TooltipFactory.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public enum TooltipFactory { public static func makeTooltip( diff --git a/LayoutKit/LayoutKit/Types.swift b/LayoutKit/LayoutKit/Types.swift index c14dbe27..75bc22cc 100644 --- a/LayoutKit/LayoutKit/Types.swift +++ b/LayoutKit/LayoutKit/Types.swift @@ -1,5 +1,5 @@ import Foundation -import Base +import BasePublic -public typealias EdgeInsets = Base.EdgeInsets +public typealias EdgeInsets = BasePublic.EdgeInsets diff --git a/LayoutKit/LayoutKit/UI/Actions/AnalyticsClickEventHandling.swift b/LayoutKit/LayoutKit/UI/Actions/AnalyticsClickEventHandling.swift index c95dac7c..fabb5104 100644 --- a/LayoutKit/LayoutKit/UI/Actions/AnalyticsClickEventHandling.swift +++ b/LayoutKit/LayoutKit/UI/Actions/AnalyticsClickEventHandling.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface public protocol AnalyticsTouchEventHandling { diff --git a/LayoutKit/LayoutKit/UI/Actions/CommonHandlerExtensions.swift b/LayoutKit/LayoutKit/UI/Actions/CommonHandlerExtensions.swift index 0c267ea7..f4495764 100644 --- a/LayoutKit/LayoutKit/UI/Actions/CommonHandlerExtensions.swift +++ b/LayoutKit/LayoutKit/UI/Actions/CommonHandlerExtensions.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface extension CommonHandler { diff --git a/LayoutKit/LayoutKit/UI/Actions/GalleryEvent/GalleryScrollEventHandling.swift b/LayoutKit/LayoutKit/UI/Actions/GalleryEvent/GalleryScrollEventHandling.swift index a85e8533..56304646 100644 --- a/LayoutKit/LayoutKit/UI/Actions/GalleryEvent/GalleryScrollEventHandling.swift +++ b/LayoutKit/LayoutKit/UI/Actions/GalleryEvent/GalleryScrollEventHandling.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface public protocol GalleryScrollEventHandling { diff --git a/LayoutKit/LayoutKit/UI/Actions/MenuExtensions.swift b/LayoutKit/LayoutKit/UI/Actions/MenuExtensions.swift index 71f30ba3..8560e3ea 100644 --- a/LayoutKit/LayoutKit/UI/Actions/MenuExtensions.swift +++ b/LayoutKit/LayoutKit/UI/Actions/MenuExtensions.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import BaseUI +import BaseUIPublic import LayoutKitInterface extension Menu { diff --git a/LayoutKit/LayoutKit/UI/Actions/PagerEventHandling.swift b/LayoutKit/LayoutKit/UI/Actions/PagerEventHandling.swift index 0329448e..d61d938d 100644 --- a/LayoutKit/LayoutKit/UI/Actions/PagerEventHandling.swift +++ b/LayoutKit/LayoutKit/UI/Actions/PagerEventHandling.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface public protocol PagerEventHandling { diff --git a/LayoutKit/LayoutKit/UI/Actions/TooltipEventPerforming.swift b/LayoutKit/LayoutKit/UI/Actions/TooltipEventPerforming.swift index c7b26513..b2a0777d 100644 --- a/LayoutKit/LayoutKit/UI/Actions/TooltipEventPerforming.swift +++ b/LayoutKit/LayoutKit/UI/Actions/TooltipEventPerforming.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public protocol TooltipEventPerforming { func perform(tooltipEvent event: TooltipEvent, from sender: AnyObject) diff --git a/LayoutKit/LayoutKit/UI/Actions/UIActionEventPerformingAdapter.swift b/LayoutKit/LayoutKit/UI/Actions/UIActionEventPerformingAdapter.swift index 225f05ea..d8238c84 100644 --- a/LayoutKit/LayoutKit/UI/Actions/UIActionEventPerformingAdapter.swift +++ b/LayoutKit/LayoutKit/UI/Actions/UIActionEventPerformingAdapter.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic public final class UIActionEventPerformingAdapter: UIActionEventPerforming { public typealias Transform = (UIActionEvent) -> HandledType? diff --git a/LayoutKit/LayoutKit/UI/Base/GenericCollectionLayout.swift b/LayoutKit/LayoutKit/UI/Base/GenericCollectionLayout.swift index 7b543002..7f2f4de7 100644 --- a/LayoutKit/LayoutKit/UI/Base/GenericCollectionLayout.swift +++ b/LayoutKit/LayoutKit/UI/Base/GenericCollectionLayout.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import Base +import BasePublic public struct GenericCollectionLayout { public let frames: [CGRect] @@ -15,7 +15,7 @@ public struct GenericCollectionLayout { public init(frames: [CGRect], pageSize: CGSize) { self.frames = frames - self.contentSize = modified(Base.contentSize(for: frames)) { + self.contentSize = modified(BasePublic.contentSize(for: frames)) { if pageSize.width > 0 { $0.width = $0.width.ceiled(toStep: pageSize.width) } diff --git a/LayoutKit/LayoutKit/UI/Base/GenericCollectionReusableView.swift b/LayoutKit/LayoutKit/UI/Base/GenericCollectionReusableView.swift index 222a2d00..8dec3d28 100644 --- a/LayoutKit/LayoutKit/UI/Base/GenericCollectionReusableView.swift +++ b/LayoutKit/LayoutKit/UI/Base/GenericCollectionReusableView.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic public final class GenericCollectionReusableView: UICollectionReusableView { public private(set) var model: UIViewRenderable! diff --git a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewCell.swift b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewCell.swift index 135a811a..8e578ff2 100644 --- a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewCell.swift +++ b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewCell.swift @@ -1,8 +1,8 @@ import Foundation import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic open class GenericCollectionViewCell: UICollectionViewCell, VisibleBoundsTrackingContainer { public private(set) var model: UIViewRenderable! diff --git a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewDataSource.swift b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewDataSource.swift index c4b72823..44f04bc4 100644 --- a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewDataSource.swift +++ b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewDataSource.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic public protocol CollectionCellModel: UIViewRenderable, AccessibilityContaining { var reuseID: String { get } diff --git a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewLayout.swift b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewLayout.swift index 4040ee01..1c12f0fe 100644 --- a/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewLayout.swift +++ b/LayoutKit/LayoutKit/UI/Base/GenericCollectionViewLayout.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic public final class GenericCollectionViewLayout: UICollectionViewLayout { public var layout: GenericCollectionLayout? { diff --git a/LayoutKit/LayoutKit/UI/Base/PageIndicator/IndicatorState/IndicatorStateAnimator.swift b/LayoutKit/LayoutKit/UI/Base/PageIndicator/IndicatorState/IndicatorStateAnimator.swift index 5bf9ab3b..b9e47072 100644 --- a/LayoutKit/LayoutKit/UI/Base/PageIndicator/IndicatorState/IndicatorStateAnimator.swift +++ b/LayoutKit/LayoutKit/UI/Base/PageIndicator/IndicatorState/IndicatorStateAnimator.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic struct IndicatorStateAnimator { let configuration: PageIndicatorConfiguration diff --git a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorConfiguration.swift b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorConfiguration.swift index 3496e27f..e43752ef 100644 --- a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorConfiguration.swift +++ b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorConfiguration.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct PageIndicatorConfiguration: Equatable { public enum Animation { diff --git a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayer.swift b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayer.swift index 70dab2b4..6d063057 100644 --- a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayer.swift +++ b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayer.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic typealias Scale = (x: CGFloat, y: CGFloat) diff --git a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayerParams.swift b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayerParams.swift index 2ef6733c..e52b0aa1 100644 --- a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayerParams.swift +++ b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorLayerParams.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic struct PageIndicatorLayerParams { let itemWidth: CGFloat @@ -22,11 +22,15 @@ struct PageIndicatorLayerParams { switch itemPlacement { case let .fixed(spaceBetweenCenters): itemWidth = spaceBetweenCenters - let itemsVisibleWidth = boundsSize.width / itemWidth - visiblePageCount = min(Int(itemsVisibleWidth), numberOfPages) + if itemWidth != 0 { + let itemsVisibleWidth = boundsSize.width / itemWidth + visiblePageCount = min(Int(itemsVisibleWidth), numberOfPages) + } else { + visiblePageCount = 0 + } case let .stretch(_, maxVisibleItems): visiblePageCount = min(maxVisibleItems, numberOfPages) - itemWidth = boundsSize.width / (CGFloat(visiblePageCount)) + itemWidth = boundsSize.width / CGFloat(visiblePageCount) } let currentPage = Int(floor(position)) diff --git a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorView.swift b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorView.swift index f10272a6..3338593e 100644 --- a/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorView.swift +++ b/LayoutKit/LayoutKit/UI/Base/PageIndicator/PageIndicatorView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic final class PageIndicatorView: UIView { var currentIndexPosition: CGFloat { diff --git a/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager+ScrollDelegate.swift b/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager+ScrollDelegate.swift index 2c0cbad7..54023e1c 100644 --- a/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager+ScrollDelegate.swift +++ b/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager+ScrollDelegate.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension ScrollableContentPager: ScrollDelegate { public func onWillBeginDragging(_ scrollView: ScrollView) { diff --git a/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager.swift b/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager.swift index ce0d8f89..03d6e45c 100644 --- a/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager.swift +++ b/LayoutKit/LayoutKit/UI/Base/ScrollableContentPager.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public final class ScrollableContentPager: NSObject { private var indexedPageOrigins: [(origin: CGFloat, index: Int)] = [] diff --git a/LayoutKit/LayoutKit/UI/Blocks/AccessibilityBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/AccessibilityBlock+UIViewRenderableBlock.swift index 4d1066b1..d0c92ecf 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/AccessibilityBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/AccessibilityBlock+UIViewRenderableBlock.swift @@ -1,8 +1,8 @@ import UIKit -import Base -import BaseUI -import CommonCore +import BasePublic +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface #if INTERNAL_BUILD diff --git a/LayoutKit/LayoutKit/UI/Blocks/AnimatableImageBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/AnimatableImageBlock+UIViewRenderableBlock.swift index 51a0842b..6aa282b8 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/AnimatableImageBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/AnimatableImageBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension AnimatableImageBlock { public static func makeBlockView() -> BlockView { AnimatableImageContainer(frame: .zero) } diff --git a/LayoutKit/LayoutKit/UI/Blocks/Array+UIViewRenderable.swift b/LayoutKit/LayoutKit/UI/Blocks/Array+UIViewRenderable.swift index 8959bf6a..944447cf 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/Array+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/Array+UIViewRenderable.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension Array where Element == BlockView { func reused( diff --git a/LayoutKit/LayoutKit/UI/Blocks/BackgroundBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/BackgroundBlock+UIViewRenderableBlock.swift index e69353c9..cf58b670 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/BackgroundBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/BackgroundBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension BackgroundBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/BlockViewProtocol.swift b/LayoutKit/LayoutKit/UI/Blocks/BlockViewProtocol.swift index 6b1dea91..b87f80c3 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/BlockViewProtocol.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/BlockViewProtocol.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public protocol BlockViewProtocol: AnyObject, VisibleBoundsTracking, EffectiveBackgroundColorProviding {} diff --git a/LayoutKit/LayoutKit/UI/Blocks/ContainerBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/ContainerBlock+UIViewRenderableBlock.swift index 4e211f0c..2da92c38 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/ContainerBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/ContainerBlock+UIViewRenderableBlock.swift @@ -2,9 +2,9 @@ import CoreGraphics import Foundation import UIKit -import Base -import BaseUI -import CommonCore +import BasePublic +import BaseUIPublic +import CommonCorePublic extension ContainerBlock { public static func makeBlockView() -> BlockView { ContainerBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/DebugInfoBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/DebugInfoBlock+UIViewRenderableBlock.swift index 61cc79db..9fc881e0 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/DebugInfoBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/DebugInfoBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension DebugInfoBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/DecoratingBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/DecoratingBlock+UIViewRenderableBlock.swift index f5ccdb8b..c0065840 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/DecoratingBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/DecoratingBlock+UIViewRenderableBlock.swift @@ -2,8 +2,8 @@ import CoreGraphics import Foundation import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension DecoratingBlock { @@ -257,16 +257,11 @@ private final class DecoratingView: UIControl, BlockViewProtocol, VisibleBoundsT super.layoutSubviews() let shouldMakeBorderLayer: Bool - if #available(iOS 11, *) { - let boundary = model.boundary.makeInfo(for: bounds.size) - shouldMakeBorderLayer = boundary.layer != nil - layer.cornerRadius = boundary.radius - layer.maskedCorners = boundary.corners - layer.mask = boundary.layer - } else { - shouldMakeBorderLayer = true - layer.mask = model.boundary.makeMaskLayer(for: bounds.size) - } + let boundary = model.boundary.makeInfo(for: bounds.size) + shouldMakeBorderLayer = boundary.layer != nil + layer.cornerRadius = boundary.radius + layer.maskedCorners = boundary.corners + layer.mask = boundary.layer if let border = model.border { if shouldMakeBorderLayer, diff --git a/LayoutKit/LayoutKit/UI/Blocks/DetachableAnimationBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/DetachableAnimationBlock+UIViewRenderableBlock.swift index c60d0475..6fecec49 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/DetachableAnimationBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/DetachableAnimationBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension DetachableAnimationBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/EffectiveBackgroundColorProviding.swift b/LayoutKit/LayoutKit/UI/Blocks/EffectiveBackgroundColorProviding.swift index 0830d5ab..7c773c9a 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/EffectiveBackgroundColorProviding.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/EffectiveBackgroundColorProviding.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public protocol EffectiveBackgroundColorProviding { var effectiveBackgroundColor: UIColor? { get } diff --git a/LayoutKit/LayoutKit/UI/Blocks/EmptyBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/EmptyBlock+UIViewRenderableBlock.swift index b1ae8d25..63862185 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/EmptyBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/EmptyBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension EmptyBlock { public static func makeBlockView() -> BlockView { EmptyBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/GalleryBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/GalleryBlock+UIViewRenderableBlock.swift index be9925e5..fc818e03 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/GalleryBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/GalleryBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension GalleryBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/GenericViewBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/GenericViewBlock+UIViewRenderableBlock.swift index a78f9409..fe59a5e4 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/GenericViewBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/GenericViewBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension GenericViewBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/GridBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/GridBlock+UIViewRenderableBlock.swift index 8d4afd36..8e2490ef 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/GridBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/GridBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension GridBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/ImageBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/ImageBlock+UIViewRenderableBlock.swift index 0b8914d7..3aeee373 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/ImageBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/ImageBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension ImageBlock { public static func makeBlockView() -> BlockView { RemoteImageViewContainer() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/LaidOutBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/LaidOutBlock+UIViewRenderableBlock.swift index 47e78ad3..d656b792 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/LaidOutBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/LaidOutBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension LaidOutBlock where T: BlockWithLayout { static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/LayeredBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/LayeredBlock+UIViewRenderableBlock.swift index 044f504e..dadfb3d1 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/LayeredBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/LayeredBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension LayeredBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/MaskedBlock+UIViewRenderable.swift b/LayoutKit/LayoutKit/UI/Blocks/MaskedBlock+UIViewRenderable.swift index 32be3ae7..8f7d5155 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/MaskedBlock+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/MaskedBlock+UIViewRenderable.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension MaskedBlock: UIViewRenderable { public static func makeBlockView() -> BlockView { MaskedBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/PageControlBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/PageControlBlock+UIViewRenderableBlock.swift index 28664f76..cc242e30 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/PageControlBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/PageControlBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension PageControlBlock { public static func makeBlockView() -> BlockView { PageControlBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/PagerBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/PagerBlock+UIViewRenderableBlock.swift index 10320a67..1238f306 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/PagerBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/PagerBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface extension PagerBlock { @@ -58,7 +58,8 @@ private final class PagerView: BlockView { self.overscrollDelegate = overscrollDelegate let galleryState = GalleryViewState( - contentPageIndex: CGFloat(state.currentPage) + contentPageIndex: CGFloat(state.currentPage), + itemsCount: model.items.count ) let layoutFactory: GalleryView.LayoutFactory = { [unowned self] model, boundsSize in let pagerLayout = PagerViewLayout( diff --git a/LayoutKit/LayoutKit/UI/Blocks/PinchToZoomBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/PinchToZoomBlock+UIViewRenderableBlock.swift index f6e21f7b..ae3adb3c 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/PinchToZoomBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/PinchToZoomBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension PinchToZoomBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/ReferenceEquatable.swift b/LayoutKit/LayoutKit/UI/Blocks/ReferenceEquatable.swift index 40d3ee6c..127d5db9 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/ReferenceEquatable.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/ReferenceEquatable.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic protocol ReferenceEquatable: Equatable { var source: Variable { get } diff --git a/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift b/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift index 7421412f..8c4b54cb 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/RenderingDelegate.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic #if os(iOS) public protocol RenderingDelegate: AnyObject { diff --git a/LayoutKit/LayoutKit/UI/Blocks/SeparatorBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/SeparatorBlock+UIViewRenderableBlock.swift index 40cca87b..1703e232 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/SeparatorBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/SeparatorBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension SeparatorBlock { public static func makeBlockView() -> BlockView { SeparatorBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/ShadedBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/ShadedBlock+UIViewRenderableBlock.swift index ea2dae70..7e1b103e 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/ShadedBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/ShadedBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension ShadedBlock { public static func makeBlockView() -> BlockView { ShadedBlockView() } diff --git a/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift index ec1a7d38..11747cdc 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/StateBlock+UIViewRenderableBlock.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension StateBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/SwipeContainerBlock+UIViewRenderable.swift b/LayoutKit/LayoutKit/UI/Blocks/SwipeContainerBlock+UIViewRenderable.swift index f9bf4702..f25a2858 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/SwipeContainerBlock+UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/SwipeContainerBlock+UIViewRenderable.swift @@ -4,7 +4,7 @@ import CoreGraphics import Foundation import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface extension SwipeContainerBlock { @@ -132,9 +132,7 @@ private final class SwipeContainerView: UIScrollView, UIScrollViewDelegate { isPagingEnabled = true showsHorizontalScrollIndicator = false delegate = self - if #available(iOS 11, *) { - disableContentInsetAdjustmentBehavior() - } + disableContentInsetAdjustmentBehavior() scrollsToTop = false } diff --git a/LayoutKit/LayoutKit/UI/Blocks/SwitchBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/SwitchBlock+UIViewRenderableBlock.swift index 3a4a8363..11794420 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/SwitchBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/SwitchBlock+UIViewRenderableBlock.swift @@ -1,8 +1,8 @@ import Foundation import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension SwitchBlock { diff --git a/LayoutKit/LayoutKit/UI/Blocks/SwitchableContainerBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/SwitchableContainerBlock+UIViewRenderableBlock.swift index 84c9fc57..c6218089 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/SwitchableContainerBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/SwitchableContainerBlock+UIViewRenderableBlock.swift @@ -1,8 +1,8 @@ import Foundation import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension SwitchableContainerBlock { diff --git a/LayoutKit/LayoutKit/UI/Blocks/TabsBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TabsBlock+UIViewRenderableBlock.swift index 4c23929f..f67978c1 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TabsBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TabsBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension TabsBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/TextBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TextBlock+UIViewRenderableBlock.swift index e6c4e43f..f988eee1 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TextBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TextBlock+UIViewRenderableBlock.swift @@ -1,8 +1,8 @@ import Foundation import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension TextBlock { diff --git a/LayoutKit/LayoutKit/UI/Blocks/TextFieldBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TextFieldBlock+UIViewRenderableBlock.swift index 8361437a..b439216f 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TextFieldBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TextFieldBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension TextFieldBlock { diff --git a/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift index be56eec6..97f095cc 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TextInputBlock+UIViewRenderableBlock.swift @@ -1,7 +1,7 @@ import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface extension TextInputBlock { @@ -17,7 +17,7 @@ extension TextInputBlock { inputView.setText(value: textValue, typo: textTypo) inputView.setHint(hint) inputView.setHighlightColor(highlightColor) - inputView.setInputType(inputType) + inputView.setKeyboardType(keyboardType) inputView.setMultiLineMode(multiLineMode) inputView.setMaxVisibleLines(maxVisibleLines) inputView.setSelectAllOnFocus(selectAllOnFocus) @@ -36,24 +36,21 @@ extension TextInputBlock { private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { private let multiLineInput = UITextView() private let singleLineInput = UITextField() - private let selectionView = UIPickerView() private let hintView = UILabel() private weak var parentScrollView: ScrollView? private var tapGestureRecognizer: UITapGestureRecognizer? private var scrollingWasDone = false - @Binding private var textValue: String + private var textValue: Binding? private var selectAllOnFocus = false private var onFocusActions: [UserInterfaceAction] = [] private var onBlurActions: [UserInterfaceAction] = [] private var path: UIElementPath? private weak var observer: ElementStateObserver? private var isRightToLeft = false - private var selectionItems: [TextInputBlock.InputType.SelectionItem]? var effectiveBackgroundColor: UIColor? { backgroundColor } override init(frame: CGRect) { - self._textValue = .empty super.init(frame: frame) isRightToLeft = UIView @@ -78,9 +75,6 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { hintView.isUserInteractionEnabled = false hintView.isHidden = true - selectionView.delegate = self - selectionView.dataSource = self - addSubview(multiLineInput) addSubview(singleLineInput) addSubview(hintView) @@ -119,19 +113,9 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { return multiLineInput.attributedText.string } - func setInputType(_ type: TextInputBlock.InputType) { - switch type { - case let .keyboard(type): - multiLineInput.inputView = nil - multiLineInput.tintColor = nil - selectionItems = nil - multiLineInput.keyboardType = type.uiType - singleLineInput.keyboardType = type.uiType - case let .selection(items): - selectionItems = items - multiLineInput.tintColor = multiLineInput.backgroundColor - multiLineInput.inputView = selectionView - } + func setKeyboardType(_ type: TextInputBlock.KeyboardType) { + multiLineInput.keyboardType = type.uiType + singleLineInput.keyboardType = type.uiType } func setMultiLineMode(_ multiLineMode: Bool) { @@ -174,7 +158,7 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { func setText(value: Binding, typo: Typo) { let textTypo = isRightToLeft ? typo.with(alignment: .right) : typo - self._textValue = value + self.textValue = value let attributedText = value.wrappedValue.with(typo: textTypo) multiLineInput.attributedText = attributedText singleLineInput.attributedText = attributedText @@ -274,12 +258,6 @@ private final class TextInputBlockView: BlockView, VisibleBoundsTrackingLeaf { extension TextInputBlockView { func inputViewDidBeginEditing(_ view: UIView) { - if let pickerView = multiLineInput.inputView as? UIPickerView { - let index = selectionItems?.firstIndex { $0.text == textValue } ?? 0 - pickerView.selectRow(index, inComponent: 0, animated: false) - $textValue.setValue(selectionItems?[index].text ?? "", responder: view) - } - startListeningTap() if selectAllOnFocus { view.selectAll(nil) @@ -289,7 +267,7 @@ extension TextInputBlockView { func inputViewDidChange(_ view: UIView) { updateHintVisibility() - $textValue.setValue(currentText, responder: view) + textValue?.setValue(currentText, responder: view) } func inputViewDidEndEditing(_: UIView) { @@ -362,10 +340,6 @@ extension TextInputBlockView: UITextFieldDelegate { func textFieldDidEndEditing(_ textField: UITextField) { inputViewDidEndEditing(textField) } - - func textView(_: UITextView, shouldChangeTextIn _: NSRange, replacementText _: String) -> Bool { - selectionItems == nil - } } extension TextInputBlockView { @@ -399,27 +373,7 @@ extension TextInputBlockView { } } -extension TextInputBlockView: UIPickerViewDataSource { - func numberOfComponents(in _: UIPickerView) -> Int { - 1 - } - - func pickerView(_: UIPickerView, numberOfRowsInComponent _: Int) -> Int { - selectionItems?.count ?? 0 - } - - func pickerView(_: UIPickerView, didSelectRow row: Int, inComponent _: Int) { - $textValue.setValue(selectionItems?[row].text ?? "", responder: self) - } -} - -extension TextInputBlockView: UIPickerViewDelegate { - func pickerView(_: UIPickerView, titleForRow row: Int, forComponent _: Int) -> String? { - selectionItems?[row].value - } -} - -extension TextInputBlock.InputType.KeyboardType { +extension TextInputBlock.KeyboardType { fileprivate var uiType: UIKeyboardType { switch self { case .default: diff --git a/LayoutKit/LayoutKit/UI/Blocks/TransitioningBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/TransitioningBlock+UIViewRenderableBlock.swift index 3c843676..02f43ba5 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/TransitioningBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/TransitioningBlock+UIViewRenderableBlock.swift @@ -2,8 +2,8 @@ import CoreGraphics import Foundation import UIKit -import Base -import CommonCore +import BasePublic +import CommonCorePublic extension TransitioningBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Blocks/UIView+TransitioningAnimation.swift b/LayoutKit/LayoutKit/UI/Blocks/UIView+TransitioningAnimation.swift index 4150bdad..e50acb39 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/UIView+TransitioningAnimation.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/UIView+TransitioningAnimation.swift @@ -2,7 +2,7 @@ import CoreGraphics import Foundation import UIKit -import CommonCore +import CommonCorePublic extension UIView { func perform( diff --git a/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift b/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift index 0785a1f2..5f2da2c1 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderable.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic public protocol UIViewRenderable { static func makeBlockView() -> BlockView diff --git a/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderableBlockWithLayout.swift b/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderableBlockWithLayout.swift index 76352d8b..65e36129 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderableBlockWithLayout.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/UIViewRenderableBlockWithLayout.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic extension BlockWithLayout { public func configureBlockView( diff --git a/LayoutKit/LayoutKit/UI/Blocks/VideoBlock+UIViewRenderableBlock.swift b/LayoutKit/LayoutKit/UI/Blocks/VideoBlock+UIViewRenderableBlock.swift index 44117501..e234d738 100644 --- a/LayoutKit/LayoutKit/UI/Blocks/VideoBlock+UIViewRenderableBlock.swift +++ b/LayoutKit/LayoutKit/UI/Blocks/VideoBlock+UIViewRenderableBlock.swift @@ -2,7 +2,7 @@ import AVFoundation import Foundation import UIKit -import CommonCore +import CommonCorePublic extension VideoBlock { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Views/AnimatingGradientView.swift b/LayoutKit/LayoutKit/UI/Views/AnimatingGradientView.swift index 6e9484ee..b0d84e9c 100644 --- a/LayoutKit/LayoutKit/UI/Views/AnimatingGradientView.swift +++ b/LayoutKit/LayoutKit/UI/Views/AnimatingGradientView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public final class AnimatingGradientView: UIView { private let gradientView: LinearGradientView diff --git a/LayoutKit/LayoutKit/UI/Views/Background+UIViewRendering.swift b/LayoutKit/LayoutKit/UI/Views/Background+UIViewRendering.swift index a55367e8..e3fffbd7 100644 --- a/LayoutKit/LayoutKit/UI/Views/Background+UIViewRendering.swift +++ b/LayoutKit/LayoutKit/UI/Views/Background+UIViewRendering.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic extension Background: UIViewRenderable { public static func makeBlockView() -> BlockView { diff --git a/LayoutKit/LayoutKit/UI/Views/BoxShadowView.swift b/LayoutKit/LayoutKit/UI/Views/BoxShadowView.swift index ddbd04c5..d8169e62 100644 --- a/LayoutKit/LayoutKit/UI/Views/BoxShadowView.swift +++ b/LayoutKit/LayoutKit/UI/Views/BoxShadowView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public final class BoxShadowView: UIView { public var shadowColor: Color { diff --git a/LayoutKit/LayoutKit/UI/Views/ContextMenuDelegate.swift b/LayoutKit/LayoutKit/UI/Views/ContextMenuDelegate.swift index 4683001a..fb34a705 100644 --- a/LayoutKit/LayoutKit/UI/Views/ContextMenuDelegate.swift +++ b/LayoutKit/LayoutKit/UI/Views/ContextMenuDelegate.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic final class ContextMenuDelegate: NSObject, UIContextMenuInteractionDelegate { private let contextMenu: ContextMenu diff --git a/LayoutKit/LayoutKit/UI/Views/GalleryView.swift b/LayoutKit/LayoutKit/UI/Views/GalleryView.swift index 63b5a91a..1058d47c 100644 --- a/LayoutKit/LayoutKit/UI/Views/GalleryView.swift +++ b/LayoutKit/LayoutKit/UI/Views/GalleryView.swift @@ -1,7 +1,7 @@ import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic import LayoutKitInterface private typealias CellType = GenericCollectionViewCell @@ -32,7 +32,7 @@ public final class GalleryView: BlockView { private var model: GalleryViewModel! private var layout: GalleryViewLayouting! - private var state: GalleryViewState = .default + private var state: GalleryViewState! private var layoutFactory: LayoutFactory! private var deferredStateSetting = DeferredStateSetting.idle private var scrollStartOffset: CGFloat = 0 @@ -202,9 +202,7 @@ public final class GalleryView: BlockView { collectionView.register(CellType.self, forCellWithReuseIdentifier: reuseID) collectionView.dataSource = dataSource - if #available(iOS 11, *) { - collectionView.disableContentInsetAdjustmentBehavior() - } + collectionView.disableContentInsetAdjustmentBehavior() super.init(frame: frame) (collectionView as UIScrollView).delegate = compoundScrollDelegate @@ -251,7 +249,7 @@ public final class GalleryView: BlockView { animated: Bool ) { switch contentPosition { - case let .offset(value): + case let .offset(value, _): setContentOffset(value, animated: false) case let .paging(pageIndex): let offset = layout.contentOffset(pageIndex: pageIndex) @@ -283,13 +281,20 @@ extension GalleryView: ScrollDelegate { let contentPosition: GalleryViewState.Position switch model.scrollMode { case .default: - contentPosition = .offset(offset) + contentPosition = .offset( + offset, + firstVisibleItemIndex: Int(layout.pageIndex(forContentOffset: CGFloat(offset))) + ) case .fixedPaging, .autoPaging: let pageIndex = layout.pageIndex(forContentOffset: offset) contentPosition = .paging(index: pageIndex) } - let newState = GalleryViewState(contentPosition: contentPosition, isScrolling: true) + let newState = GalleryViewState( + contentPosition: contentPosition, + itemsCount: model.items.count, + isScrolling: true + ) setState(newState, notifyingObservers: true) updatesDelegate?.onContentOffsetChanged(offset, in: model) visibilityDelegate?.onGalleryVisibilityChanged() @@ -312,7 +317,11 @@ extension GalleryView: ScrollDelegate { } private func onDidEndScroll(_ scrollView: ScrollView) { - let newState = GalleryViewState(contentPosition: state.contentPosition, isScrolling: false) + let newState = GalleryViewState( + contentPosition: state.contentPosition, + itemsCount: model.items.count, + isScrolling: false + ) setState(newState, notifyingObservers: true) visibilityDelegate?.onGalleryVisibilityChanged() diff --git a/LayoutKit/LayoutKit/UI/Views/NinePatchImageView.swift b/LayoutKit/LayoutKit/UI/Views/NinePatchImageView.swift index ef54ebd4..d45450d0 100644 --- a/LayoutKit/LayoutKit/UI/Views/NinePatchImageView.swift +++ b/LayoutKit/LayoutKit/UI/Views/NinePatchImageView.swift @@ -1,7 +1,7 @@ import UIKit -import Base -import CommonCore +import BasePublic +import CommonCorePublic public final class NinePatchImageView: UIView, RemoteImageViewContentProtocol { private var image: UIImage? diff --git a/LayoutKit/LayoutKit/UI/Views/SegmentedProgressView.swift b/LayoutKit/LayoutKit/UI/Views/SegmentedProgressView.swift index 881dbc1f..c5677be8 100644 --- a/LayoutKit/LayoutKit/UI/Views/SegmentedProgressView.swift +++ b/LayoutKit/LayoutKit/UI/Views/SegmentedProgressView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public final class SegmentedProgressView: UIView { public var currentTimestamp: Double = 0 { diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift index 92c41c39..c9d92951 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabContentsView.swift @@ -1,7 +1,7 @@ import UIKit -import Base -import CommonCore +import BasePublic +import CommonCorePublic import LayoutKitInterface internal class TabContentsView: BlockView { @@ -54,7 +54,7 @@ internal class TabContentsView: BlockView { private var layout: TabContentsViewLayout! { didSet { collectionViewLayout.layout = layout.map { - var contentSize = Base.contentSize(for: $0.pageFrames) + var contentSize = BasePublic.contentSize(for: $0.pageFrames) if bounds.width > 0 { contentSize.width = contentSize.width.ceiled(toStep: bounds.width) } @@ -149,9 +149,7 @@ internal class TabContentsView: BlockView { collectionView.showsVerticalScrollIndicator = false collectionView.isPagingEnabled = true - if #available(iOS 11, *) { - collectionView.disableContentInsetAdjustmentBehavior() - } + collectionView.disableContentInsetAdjustmentBehavior() super.init(frame: .zero) addSubview(collectionView) diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListSelectionDataSourceImpl.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListSelectionDataSourceImpl.swift index b804c791..db91febd 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListSelectionDataSourceImpl.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListSelectionDataSourceImpl.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic final class TabListSelectionDataSourceImpl: TabListSelectionDataSource { private let listModel: TabListViewModel diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListView.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListView.swift index 79397df6..8f81261c 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListView.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic final class TabListView: UIView { private let collectionView: UICollectionView @@ -222,8 +222,6 @@ private func makeCollectionView(layout: UICollectionViewLayout) -> UICollectionV collectionView.backgroundColor = .clear collectionView.scrollsToTop = false collectionView.alwaysBounceHorizontal = true - if #available(iOS 11, *) { - collectionView.contentInsetAdjustmentBehavior = .never - } + collectionView.contentInsetAdjustmentBehavior = .never return collectionView } diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDataSource.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDataSource.swift index 22a1d39b..5ef5ea53 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDataSource.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDataSource.swift @@ -1,6 +1,6 @@ import UIKit -import BaseUI +import BaseUIPublic final class TabListViewDataSource: NSObject, UICollectionViewDataSource { private let tabs: [TabTitleViewModel] diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDelegate.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDelegate.swift index 76f0bdfa..0a49daca 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDelegate.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabListViewDelegate.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic import LayoutKitInterface final class TabListViewDelegate: NSObject, UICollectionViewDelegateFlowLayout { diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabSelectionWireframe.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabSelectionWireframe.swift index 8fbfd856..a6bcf4d6 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabSelectionWireframe.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabSelectionWireframe.swift @@ -1,6 +1,6 @@ import UIKit -import Base +import BasePublic import LayoutKitInterface final class TabSelectionWireframe { diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabTitlesViewModel.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabTitlesViewModel.swift index 2a69ef2e..c97aa485 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabTitlesViewModel.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabTitlesViewModel.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic struct TabTitlesViewModel { let items: [TabTitleViewModel] diff --git a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabbedPagesView.swift b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabbedPagesView.swift index dfcd82b0..394493bc 100644 --- a/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabbedPagesView.swift +++ b/LayoutKit/LayoutKit/UI/Views/TabbedPages/TabbedPagesView.swift @@ -1,6 +1,6 @@ import UIKit -import CommonCore +import CommonCorePublic public final class TabbedPagesView: BlockView, VisibleBoundsTrackingContainer { private var selectionWireframe: TabSelectionWireframe? diff --git a/LayoutKit/LayoutKit/UI/Views/URLActionHandlingView.swift b/LayoutKit/LayoutKit/UI/Views/URLActionHandlingView.swift index 2fcf88f2..c269a750 100644 --- a/LayoutKit/LayoutKit/UI/Views/URLActionHandlingView.swift +++ b/LayoutKit/LayoutKit/UI/Views/URLActionHandlingView.swift @@ -1,6 +1,6 @@ import UIKit -import Base +import BasePublic public final class URLActionHandlingView: UIView, UIActionEventPerforming { private let handler: UrlOpener diff --git a/LayoutKit/LayoutKit/UI/Views/ViewWithContentInsets.swift b/LayoutKit/LayoutKit/UI/Views/ViewWithContentInsets.swift index ad3b60ac..1821e462 100644 --- a/LayoutKit/LayoutKit/UI/Views/ViewWithContentInsets.swift +++ b/LayoutKit/LayoutKit/UI/Views/ViewWithContentInsets.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic final class ViewWithContentInsets: UIView { let innerView: BlockView diff --git a/LayoutKit/LayoutKit/UI/Views/ViewWithShadow.swift b/LayoutKit/LayoutKit/UI/Views/ViewWithShadow.swift index 95a0069e..cac88ab4 100644 --- a/LayoutKit/LayoutKit/UI/Views/ViewWithShadow.swift +++ b/LayoutKit/LayoutKit/UI/Views/ViewWithShadow.swift @@ -1,7 +1,7 @@ import Foundation import UIKit -import CommonCore +import CommonCorePublic open class ViewWithShadow: UIView { public var contentView: UIView { diff --git a/LayoutKit/LayoutKit/UI/Views/VisibleBoundsTrackingCollectionView.swift b/LayoutKit/LayoutKit/UI/Views/VisibleBoundsTrackingCollectionView.swift index f1521351..2d9d19cf 100644 --- a/LayoutKit/LayoutKit/UI/Views/VisibleBoundsTrackingCollectionView.swift +++ b/LayoutKit/LayoutKit/UI/Views/VisibleBoundsTrackingCollectionView.swift @@ -1,7 +1,7 @@ import UIKit -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public final class VisibleBoundsTrackingCollectionView: NoContentTouchDelaysCollectionView, VisibleBoundsTrackingContainer { diff --git a/LayoutKit/LayoutKit/ViewModels/Background.swift b/LayoutKit/LayoutKit/ViewModels/Background.swift index 5f85b0a0..1ce64823 100644 --- a/LayoutKit/LayoutKit/ViewModels/Background.swift +++ b/LayoutKit/LayoutKit/ViewModels/Background.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKitInterface public enum Background: Equatable { diff --git a/LayoutKit/LayoutKit/ViewModels/BackgroundImage.swift b/LayoutKit/LayoutKit/ViewModels/BackgroundImage.swift index 3839b11e..bc10cdb6 100644 --- a/LayoutKit/LayoutKit/ViewModels/BackgroundImage.swift +++ b/LayoutKit/LayoutKit/ViewModels/BackgroundImage.swift @@ -1,5 +1,5 @@ -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public struct BackgroundImage { let imageHolder: ImageHolder diff --git a/LayoutKit/LayoutKit/ViewModels/GalleryViewLayout.swift b/LayoutKit/LayoutKit/ViewModels/GalleryViewLayout.swift index 74e0636c..d65f8704 100644 --- a/LayoutKit/LayoutKit/ViewModels/GalleryViewLayout.swift +++ b/LayoutKit/LayoutKit/ViewModels/GalleryViewLayout.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public protocol GalleryViewLayouting { var pageOrigins: [CGFloat] { get } diff --git a/LayoutKit/LayoutKit/ViewModels/GalleryViewMetrics.swift b/LayoutKit/LayoutKit/ViewModels/GalleryViewMetrics.swift index 8b814084..f3abb604 100644 --- a/LayoutKit/LayoutKit/ViewModels/GalleryViewMetrics.swift +++ b/LayoutKit/LayoutKit/ViewModels/GalleryViewMetrics.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public struct GalleryViewMetrics: Equatable { public let axialInsetMode: InsetMode diff --git a/LayoutKit/LayoutKit/ViewModels/GalleryViewModel.swift b/LayoutKit/LayoutKit/ViewModels/GalleryViewModel.swift index ae9d5bec..047fadca 100644 --- a/LayoutKit/LayoutKit/ViewModels/GalleryViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/GalleryViewModel.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface public struct GalleryViewModel: Equatable { diff --git a/LayoutKit/LayoutKit/ViewModels/GalleryViewState.swift b/LayoutKit/LayoutKit/ViewModels/GalleryViewState.swift index c1ea1006..a45ffb2f 100644 --- a/LayoutKit/LayoutKit/ViewModels/GalleryViewState.swift +++ b/LayoutKit/LayoutKit/ViewModels/GalleryViewState.swift @@ -1,17 +1,17 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public struct GalleryViewState: ElementState, Equatable { @frozen public enum Position: Equatable { - case offset(CGFloat) + case offset(_ value: CGFloat, firstVisibleItemIndex: Int = 0) case paging(index: CGFloat) public var offset: CGFloat? { switch self { - case let .offset(value): + case let .offset(value, _): return value case .paging: return nil @@ -39,8 +39,9 @@ public struct GalleryViewState: ElementState, Equatable { public static func ==(_ lhs: Position, _ rhs: Position) -> Bool { let accuracy = CGFloat(1e-4) switch (lhs, rhs) { - case let (.offset(lhs), .offset(rhs)): - return lhs.isApproximatelyEqualTo(rhs, withAccuracy: accuracy) + case let (.offset(lhsValue, lhsFirstVisibleItemIndex), .offset(rhsValue, rhsFirstVisibleItemIndex)): + return lhsFirstVisibleItemIndex == rhsFirstVisibleItemIndex + && lhsValue.isApproximatelyEqualTo(rhsValue, withAccuracy: accuracy) case let (.paging(index: lhs), .paging(index: rhs)): return lhs.isApproximatelyEqualTo(rhs, withAccuracy: accuracy) case (.paging, .offset): @@ -51,48 +52,62 @@ public struct GalleryViewState: ElementState, Equatable { } } - public var contentPosition: Position + public let contentPosition: Position + public let itemsCount: Int public let isScrolling: Bool - public static let `default` = GalleryViewState(contentOffset: 0) - - public init(contentOffset: CGFloat) { + public init( + contentOffset: CGFloat, + itemsCount: Int + ) { self.contentPosition = .offset(contentOffset) + self.itemsCount = itemsCount self.isScrolling = false } - public init(contentPageIndex: CGFloat) { + public init( + contentPageIndex: CGFloat, + itemsCount: Int + ) { self.contentPosition = .paging(index: contentPageIndex) + self.itemsCount = itemsCount self.isScrolling = false } public init( contentPosition: Position, + itemsCount: Int, isScrolling: Bool ) { self.contentPosition = contentPosition + self.itemsCount = itemsCount self.isScrolling = isScrolling } } extension GalleryViewState { public func resetToModelIfInconsistent(_ model: GalleryViewModel) -> GalleryViewState { - modified(self) { - switch contentPosition { - case let .paging(index: index): - if index < 0 || index >= CGFloat(model.items.count) { - $0.contentPosition = .paging(index: 0) - } else { - $0.contentPosition = .paging(index: index) - } - case .offset: - switch model.scrollMode { - case .autoPaging, .fixedPaging: - $0.contentPosition = .paging(index: 0) - case .default: - break - } + let newContentPosition: Position + let itemsCount = model.items.count + switch contentPosition { + case let .paging(index: index): + if index < 0 || index >= CGFloat(itemsCount) { + newContentPosition = .paging(index: 0) + } else { + newContentPosition = .paging(index: index) + } + case .offset: + switch model.scrollMode { + case .autoPaging, .fixedPaging: + newContentPosition = .paging(index: 0) + case .default: + newContentPosition = contentPosition } } + return GalleryViewState( + contentPosition: newContentPosition, + itemsCount: itemsCount, + isScrolling: isScrolling + ) } } diff --git a/LayoutKit/LayoutKit/ViewModels/InsetMode.swift b/LayoutKit/LayoutKit/ViewModels/InsetMode.swift index ae6ca8bc..a5bffba1 100644 --- a/LayoutKit/LayoutKit/ViewModels/InsetMode.swift +++ b/LayoutKit/LayoutKit/ViewModels/InsetMode.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public enum InsetMode: Equatable { public struct Resizable: Equatable { diff --git a/LayoutKit/LayoutKit/ViewModels/NinePatchImage.swift b/LayoutKit/LayoutKit/ViewModels/NinePatchImage.swift index 2c84958d..de4dff2e 100644 --- a/LayoutKit/LayoutKit/ViewModels/NinePatchImage.swift +++ b/LayoutKit/LayoutKit/ViewModels/NinePatchImage.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic public struct NinePatchImage { let imageHolder: ImageHolder diff --git a/LayoutKit/LayoutKit/ViewModels/PagerViewLayout.swift b/LayoutKit/LayoutKit/ViewModels/PagerViewLayout.swift index f2971168..6db1cd67 100644 --- a/LayoutKit/LayoutKit/ViewModels/PagerViewLayout.swift +++ b/LayoutKit/LayoutKit/ViewModels/PagerViewLayout.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public struct PagerViewLayout: GalleryViewLayouting, Equatable { public struct Page { diff --git a/LayoutKit/LayoutKit/ViewModels/PagerViewState.swift b/LayoutKit/LayoutKit/ViewModels/PagerViewState.swift index 3f0bfb5a..b780f23c 100644 --- a/LayoutKit/LayoutKit/ViewModels/PagerViewState.swift +++ b/LayoutKit/LayoutKit/ViewModels/PagerViewState.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct PagerViewState: ElementState, Equatable { public let numberOfPages: Int diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewLayout.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewLayout.swift index aaa567f6..3666d551 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewLayout.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewLayout.swift @@ -1,8 +1,8 @@ import CoreGraphics import Foundation -import Base -import BaseUI +import BasePublic +import BaseUIPublic struct TabContentsViewLayout: Equatable { let pageFrames: [CGRect] diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewModel.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewModel.swift index 366d119d..29f7b695 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabContentsViewModel.swift @@ -1,6 +1,6 @@ import CoreGraphics -import Base +import BasePublic import LayoutKitInterface public struct TabContentsViewModel: Equatable { diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabError.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabError.swift index 8a9c12a0..e0a4c90c 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabError.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabError.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public enum TabError: NonEmptyString, BlockError { case missingChildren diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabInterimItemExtensions.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabInterimItemExtensions.swift index 9d93aea0..d926bb66 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabInterimItemExtensions.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabInterimItemExtensions.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic extension Array where Element == CGFloat { func interim(at index: CGFloat) -> CGFloat { diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabListViewModel.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabListViewModel.swift index bdb7a51e..38436672 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabListViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabListViewModel.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public final class TabListViewModel: Equatable { public static let defaultListPaddings = EdgeInsets(top: 7, left: 12, bottom: 12, right: 12) diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabPageViewModel.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabPageViewModel.swift index 9fe4444b..fe01170d 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabPageViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabPageViewModel.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import LayoutKitInterface public class TabPageViewModel { diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabSeparatorStyle.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabSeparatorStyle.swift index aecaf2e5..d03a3a43 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabSeparatorStyle.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabSeparatorStyle.swift @@ -1,6 +1,6 @@ import CoreGraphics -import CommonCore +import CommonCorePublic public struct TabSeparatorStyle: Equatable { public let color: Color diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleStyle.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleStyle.swift index c54599d4..990254a6 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleStyle.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleStyle.swift @@ -1,7 +1,7 @@ import CoreGraphics -import BaseUI -import CommonCore +import BaseUIPublic +import CommonCorePublic public struct TabTitleStyle: Equatable { public static let defaultTypo = Typo(size: .capsS, weight: .semibold).with(height: .capsS) diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleViewModel.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleViewModel.swift index 01882c58..cb11fd58 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabTitleViewModel.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic import LayoutKitInterface final class TabTitleViewModel: Equatable { diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewModel.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewModel.swift index 79b9b87c..13b203b1 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewModel.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewModel.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic public final class TabViewModel: Equatable { public let listModel: TabListViewModel diff --git a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewState.swift b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewState.swift index fe8e6c8e..5e3aabdc 100644 --- a/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewState.swift +++ b/LayoutKit/LayoutKit/ViewModels/TabbedPages/TabViewState.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public struct TabViewState: ElementState, Equatable { public let selectedPageIndex: CGFloat diff --git a/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformer.swift b/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformer.swift index 1764300a..26667870 100644 --- a/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformer.swift +++ b/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformer.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic final class VisibilityActionPerformer { private var visibilityTimer: TimerType? diff --git a/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformers.swift b/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformers.swift index c73fe261..cbc6f175 100644 --- a/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformers.swift +++ b/LayoutKit/LayoutKit/ViewModels/VisibilityActionPerformer/VisibilityActionPerformers.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic struct VisibilityCheckParam { let requiredVisibilityDuration: TimeInterval diff --git a/Package.swift b/Package.swift index a160cc93..a7bea01c 100644 --- a/Package.swift +++ b/Package.swift @@ -13,44 +13,44 @@ let package = Package( ], targets: [ .target( - name: "BaseUI", + name: "BaseUIPublic", dependencies: [ - "BaseTiny", + "BaseTinyPublic", ], - path: "Core/BaseUI" + path: "Core/BaseUIPublic" ), .target( - name: "Base", + name: "BasePublic", dependencies: [ - "BaseTiny", - "BaseUI", + "BaseTinyPublic", + "BaseUIPublic", ], - path: "Core/Base" + path: "Core/BasePublic" ), .target( - name: "BaseTiny", - path: "Core/BaseTiny" + name: "BaseTinyPublic", + path: "Core/BaseTinyPublic" ), .target( - name: "CommonCore", + name: "CommonCorePublic", dependencies: [ - "Base", + "BasePublic", ], - path: "Core/CommonCore" + path: "Core/CommonCorePublic" ), .target( - name: "Networking", + name: "NetworkingPublic", dependencies: [ - "Base", + "BasePublic", ], - path: "Core/Networking" + path: "Core/NetworkingPublic" ), .target( name: "DivKit", dependencies: [ - "CommonCore", + "CommonCorePublic", "LayoutKit", - "Networking", + "NetworkingPublic", "Serialization", "TemplatesSupport", ], @@ -69,7 +69,7 @@ let package = Package( .target( name: "LayoutKit", dependencies: [ - "CommonCore", + "CommonCorePublic", "LayoutKitInterface", ], path: "LayoutKit/LayoutKit" @@ -77,21 +77,21 @@ let package = Package( .target( name: "LayoutKitInterface", dependencies: [ - "Base", + "BasePublic", ], path: "LayoutKit/Interface" ), .target( name: "Serialization", dependencies: [ - "CommonCore", + "CommonCorePublic", ], path: "Serialization" ), .target( name: "TemplatesSupport", dependencies: [ - "CommonCore", + "CommonCorePublic", "Serialization", ], path: "TemplatesSupport" diff --git a/Serialization/DeserializationError.swift b/Serialization/DeserializationError.swift index 2ab83601..4beca796 100644 --- a/Serialization/DeserializationError.swift +++ b/Serialization/DeserializationError.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic @frozen public indirect enum DeserializationError: Error, CustomStringConvertible { diff --git a/Serialization/DeserializationResult.swift b/Serialization/DeserializationResult.swift index a9ea360e..b257a2c5 100644 --- a/Serialization/DeserializationResult.swift +++ b/Serialization/DeserializationResult.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic @frozen public indirect enum DeserializationResult { diff --git a/Serialization/Dictionary+Serialization.swift b/Serialization/Dictionary+Serialization.swift index 9694b7dc..42d2b990 100644 --- a/Serialization/Dictionary+Serialization.swift +++ b/Serialization/Dictionary+Serialization.swift @@ -1,17 +1,10 @@ import CoreFoundation import Foundation -import CommonCore +import CommonCorePublic // MARK: Utils -extension Dictionary { - fileprivate init(_ seq: S) where S.Iterator.Element == (Key, Value) { - self.init() - for (key, value) in seq { self[key] = value } - } -} - @usableFromInline func invalidFieldErrorForKey( _ key: [T], @@ -254,24 +247,6 @@ extension Dictionary where Key == String { // MARK: Required values (public interface) extension Dictionary where Key == String { - public func getField(_ key: Key..., validator: AnyValueValidator? = nil) throws -> Any { - try getField(key, transform: { $0 as Any }, validator: validator) - } - - public func getField( - _ key: Key..., - validator: AnyValueValidator? = nil - ) throws -> CFString { - let transform: (CFTypeRef) throws -> CFString = { - if let value: CFString = safeCFCast($0) { - return value - } else { - throw invalidFieldErrorForKey(key, representation: $0) - } - } - return try getField(key, transform: transform, validator: validator) - } - @inlinable public func getField( _ key: Key..., @@ -308,15 +283,6 @@ extension Dictionary where Key == String { try getArray(key, transform: { (value: Any) throws -> Any in value }, validator: validator) } - @inlinable - public func getArray( - _ key: Key..., - transform: (T) throws -> U, - validator: AnyArrayValueValidator? = nil - ) throws -> [U] { - try getArray(key, transform: transform, validator: validator) - } - @inlinable public func getArray( _ key: Key..., @@ -332,7 +298,8 @@ extension Dictionary where Key == String { validator: AnyArrayValueValidator? = nil ) throws -> [T] { try getArray( - key, transform: { (obj: Any) -> T? in obj as? T }, + key, + transform: { (obj: Any) -> T? in obj as? T }, validator: validator ) } @@ -380,13 +347,6 @@ extension Dictionary where Key == String { // MARK: Optional values (public interface) extension Dictionary where Key == String { - public func getOptionalField( - _ key: Key..., - validator: AnyValueValidator? = nil - ) throws -> Any? { - try getOptionalField(key, transform: { $0 as Any }, validator: validator) - } - public func getOptionalField( _ key: Key..., validator: AnyValueValidator? = nil @@ -440,17 +400,6 @@ extension Dictionary where Key == String { ) } - public func getOptionalArray( - _ key: Key..., - validator: AnyArrayValueValidator? = nil - ) throws -> [Any]? { - try getOptionalArray( - key, - transform: { (value: Any) throws -> Any in value }, - validator: validator - ) - } - @inlinable public func getOptionalArray( _ key: Key..., @@ -503,11 +452,4 @@ extension Dictionary where Key == String { validator: validator ) } - - public func getOptionalURL( - _ key: Key..., - validator: AnyValueValidator? = nil - ) throws -> URL? { - try getOptionalField(key, transform: URL.init(string:), validator: validator) - } } diff --git a/Serialization/Serializable.swift b/Serialization/Serializable.swift index 4e1eec92..d36f18af 100644 --- a/Serialization/Serializable.swift +++ b/Serialization/Serializable.swift @@ -1,7 +1,7 @@ import CoreGraphics import Foundation -import CommonCore +import CommonCorePublic public protocol ValidSerializationValue {} diff --git a/Serialization/SettingProperty+Serializable.swift b/Serialization/SettingProperty+Serializable.swift index b28f923f..0bf3c4f9 100644 --- a/Serialization/SettingProperty+Serializable.swift +++ b/Serialization/SettingProperty+Serializable.swift @@ -1,6 +1,6 @@ import Foundation -import CommonCore +import CommonCorePublic extension SettingProperty where T: Serializable & Deserializable { @usableFromInline diff --git a/Serialization/Validation.swift b/Serialization/Validation.swift index 17ca1702..620f48a0 100644 --- a/Serialization/Validation.swift +++ b/Serialization/Validation.swift @@ -6,10 +6,6 @@ public protocol ValueValidator { func isValid(_ value: T) -> Bool } -public protocol ArrayValueValidator: ValueValidator { - var isPartialDeserializationAllowed: Bool { get } -} - public class AnyValueValidator: ValueValidator { private let validate: (T) -> Bool @@ -26,7 +22,7 @@ public class AnyValueValidator: ValueValidator { } } -public final class AnyArrayValueValidator: AnyValueValidator<[U]>, ArrayValueValidator { +public final class AnyArrayValueValidator: AnyValueValidator<[U]> { public let isPartialDeserializationAllowed: Bool public init( @@ -100,11 +96,3 @@ public func makeStrictArrayValidator(minItems: Int) -> AnyArrayValueValidator isPartialDeserializationAllowed: false ) } - -@inlinable -public func makeNoOpArrayValidator() -> AnyArrayValueValidator { - AnyArrayValueValidator( - arrayValidator: alwaysTrueValidator(), - isPartialDeserializationAllowed: true - ) -} diff --git a/Serialization/ValueDeserialization.swift b/Serialization/ValueDeserialization.swift index 2aebd4da..ebebe0f1 100644 --- a/Serialization/ValueDeserialization.swift +++ b/Serialization/ValueDeserialization.swift @@ -1,6 +1,6 @@ import CoreFoundation -import CommonCore +import CommonCorePublic @inlinable public func deserialize( @@ -10,22 +10,6 @@ public func deserialize( deserialize(value, transform: { $0 }, validator: validator) } -@inlinable -public func deserialize( - _ value: Any, - validator: AnyValueValidator? = nil -) -> DeserializationResult { - guard let result: CFString = safeCFCast(value as CFTypeRef) else { - return .failure(NonEmptyArray(.typeMismatch(expected: "CFString", representation: value))) - } - - guard validator?.isValid(result) != false else { - return .failure(NonEmptyArray(.invalidValue(result: result, value: value))) - } - - return .success(result) -} - @inlinable public func deserialize( _ value: Any, diff --git a/TemplatesSupport/Context.swift b/TemplatesSupport/Context.swift index 8555a9e7..19771ca7 100644 --- a/TemplatesSupport/Context.swift +++ b/TemplatesSupport/Context.swift @@ -12,6 +12,4 @@ public struct Context { self.templateToType = templateToType self.templateData = templateData } - - public static let empty = Context(templates: [:], templateToType: [:], templateData: [:]) } diff --git a/TemplatesSupport/Field.swift b/TemplatesSupport/Field.swift index d04d2916..a1686305 100644 --- a/TemplatesSupport/Field.swift +++ b/TemplatesSupport/Field.swift @@ -1,6 +1,6 @@ import CoreFoundation -import CommonCore +import CommonCorePublic import Serialization @frozen @@ -25,9 +25,7 @@ extension Field { return valueForLink(link) } } -} -extension Field { @inlinable public func value( validatedBy validator: AnyValueValidator? = nil @@ -103,44 +101,6 @@ extension Field { } return result } - - @inlinable - public func resolveValue( - context: Context, - transform: (U) -> C?, - validator: AnyArrayValueValidator - ) -> DeserializationResult where T == [C] { - switch self { - case let .value(value): - guard validator.isValid(value) != false else { - return .failure(NonEmptyArray(.invalidValue(result: value, value: nil))) - } - return .success(value) - case let .link(link): - return safeValueForLink( - { try context.templateData.getArray($0, transform: transform, validator: validator) }, - link: link - ) - } - } -} - -extension Field where T == CFString { - @inlinable - public func resolveValue( - context: Context, - validator: AnyValueValidator? = nil - ) -> DeserializationResult { - resolveValue( - validator: validator, - valueForLink: { link in - safeValueForLink( - { try context.templateData.getField($0, validator: validator) }, - link: link - ) - } - ) - } } extension Field where T: ValidSerializationValue { @@ -172,24 +132,6 @@ extension Field where T: ValidSerializationValue { } extension Field where T: RawRepresentable, T.RawValue: ValidSerializationValue { - @inlinable - public func resolveValue(context: Context) -> DeserializationResult { - resolveValue(context: context, transform: T.init(rawValue:)) - } - - @inlinable - public func resolveValue( - context: Context, - validator: AnyValueValidator - ) -> DeserializationResult { - resolveValue(context: context, transform: T.init(rawValue:), validator: validator) - } - - @inlinable - public func resolveOptionalValue(context: Context) -> DeserializationResult { - resolveOptionalValue(context: context, transform: T.init(rawValue:)) - } - @inlinable public func resolveOptionalValue( context: Context, @@ -286,24 +228,7 @@ extension Field where T: TemplateValue, T: TemplateDeserializable { return value.tryResolveParent(templates: templates).map(Field.value) } } -} -extension Field where T: Deserializable { - @inlinable - public func resolveValue(context: Context) -> DeserializationResult { - switch self { - case let .value(value): - return .success(value) - case let .link(link): - return safeValueForLink( - { try context.templateData.getField($0) }, - link: link - ) - } - } -} - -extension Field where T: TemplateValue, T: TemplateDeserializable { @inlinable public func resolveOptionalValue( context: Context, @@ -312,19 +237,6 @@ extension Field where T: TemplateValue, T: TemplateDeserializable { resolveValue(context: context, useOnlyLinks: useOnlyLinks) } - @inlinable - public func resolveValue( - context: Context, - validator: AnyValueValidator, - useOnlyLinks: Bool - ) -> DeserializationResult { - let result = resolveValue(context: context, useOnlyLinks: useOnlyLinks) - guard let value = result.value, validator.isValid(value) else { - return .failure(NonEmptyArray(.invalidValue(result: result.value, value: nil))) - } - return result - } - @inlinable public func resolveOptionalValue( context: Context, @@ -340,34 +252,6 @@ extension Field where T: TemplateValue, T: TemplateDeserializable { } return result } - - @inlinable - public func value( - validatedBy validator: AnyValueValidator? = nil, - templates: Templates, - templateToType: TemplateToType - ) -> DeserializationResult { - switch self { - case let .value(value): - let context = Context( - templates: templates, - templateToType: templateToType, - templateData: [:] - ) - let resolvedValue = try? value - .resolveParent(templates: templates) - .resolveValue(context: context, useOnlyLinks: true) - guard let result = resolvedValue, - let resultValue = result.value, - validator?.isValid(resultValue) != false else { - return .failure(NonEmptyArray(.invalidValue(result: resolvedValue?.value, value: nil))) - } - - return result - case .link: - return .noValue - } - } } extension Field { @@ -405,57 +289,6 @@ extension Field { } return result } - - @inlinable - public func value( - validatedBy validator: AnyArrayValueValidator? = nil, - templates: Templates, - templateToType: TemplateToType - ) -> DeserializationResult<[U.ResolvedValue]> where T == [U] { - switch self { - case let .value(value): - let context = Context(templates: templates, templateToType: templateToType, templateData: [:]) - let result = try? value - .resolveParent(templates: templates) - .resolveValue(context: context, validator: validator) - return result ?? .failure(NonEmptyArray(.generic)) - case .link: - return .noValue - } - } -} - -extension Field { - @inlinable - public func resolveValue(context: Context) -> DeserializationResult - where T == [U] { - switch self { - case let .value(value): - return .success(value) - case let .link(link): - return safeValueForLink( - { try context.templateData.getArray($0) }, - link: link - ) - } - } - - @inlinable - public func resolveValue( - context: Context, - validator: AnyValueValidator - ) -> DeserializationResult where T == [U] { - let result = resolveValue(context: context) - guard let resultValue = result.value, validator.isValid(resultValue) else { - var errors: NonEmptyArray = - NonEmptyArray(.invalidValue(result: result.value, value: nil)) - if let resultErrors = result.errorsOrWarnings { - errors.append(contentsOf: resultErrors) - } - return .failure(errors) - } - return result - } } @inlinable diff --git a/TemplatesSupport/ParsingMode.swift b/TemplatesSupport/ParsingMode.swift deleted file mode 100644 index d61cdf49..00000000 --- a/TemplatesSupport/ParsingMode.swift +++ /dev/null @@ -1,10 +0,0 @@ -/// Supported modes for dictionary interpretation. -public enum ParsingMode { - /// Do not treat object body as links container. - /// Should be passed when parsing templates. - case template - - /// Expect data for links resolution in object body. - /// Should be passed when parsing main respose body. - case data -} diff --git a/TemplatesSupport/SerializationExtensions.swift b/TemplatesSupport/SerializationExtensions.swift index e0ef61b3..67ed0d47 100644 --- a/TemplatesSupport/SerializationExtensions.swift +++ b/TemplatesSupport/SerializationExtensions.swift @@ -1,23 +1,9 @@ import CoreFoundation -import CommonCore +import CommonCorePublic import Serialization extension Field { - @inlinable - public init( - valueGetter: @autoclosure () -> T?, - linkGetter: @autoclosure () -> Link? - ) throws { - if let value = valueGetter() { - self = .value(value) - } else if let link = linkGetter() { - self = .link(link) - } else { - throw DeserializationError.generic - } - } - @inlinable public static func makeOptional( valueGetter: @autoclosure () -> T?, @@ -33,80 +19,12 @@ extension Field { } } -/// Deserialization for Field +/// Deserialization for Field? extension Dictionary where Key == String, Value == Any { public func link(for key: String) -> Link? { self["$" + key] as? Link } - @usableFromInline - func makeField( - _ key: String, - transform: (T) throws -> U, - validator: AnyValueValidator? = nil - ) throws -> Field { - try Field( - valueGetter: (try? getOptionalField(key, transform: transform, validator: validator)) - .flatMap { $0 }, - linkGetter: link(for: key) - ) - } - - @usableFromInline - func makeField( - _ key: String, - transform: (T) throws -> U? - ) throws -> Field { - try makeField(key, transform: { (value: T) throws -> U in - guard let result = try transform(value) else { - throw DeserializationError.generic - } - return result - }) - } - - public func getField(_ key: String) throws -> Field { - try Field( - valueGetter: (try? getOptionalField(key)).flatMap { $0 }, - linkGetter: link(for: key) - ) - } - - @inlinable - public func getField(_ key: String) throws -> Field - where T.RawValue: ValidSerializationValue { - try makeField(key, transform: { T(rawValue: $0) }) - } - - @inlinable - public func getField(_ key: String) throws -> Field { - try makeField(key, transform: { $0 as T }) - } - - @inlinable - public func getField(_ key: String) throws -> Field { - try makeField( - key, - transform: { (dict: Self) in try T(dictionary: dict) } - ) - } - - @inlinable - public func getField( - _ key: String, - templateToType: TemplateToType, - validator: AnyValueValidator? = nil - ) throws -> Field { - try makeField( - key, - transform: { (dict: Self) in try T(dictionary: dict, templateToType: templateToType) }, - validator: validator - ) - } -} - -/// Deserialization for Field? -extension Dictionary where Key == String, Value == Any { @inlinable public func getOptionalField( _ key: String, @@ -120,13 +38,6 @@ extension Dictionary where Key == String, Value == Any { ) } - public func getOptionalField(_ key: String) throws -> Field? { - Field.makeOptional( - valueGetter: (try? getOptionalField(key)).flatMap { $0 }, - linkGetter: link(for: key) - ) - } - @inlinable public func getOptionalField(_ key: String) throws -> Field? { try getOptionalField( @@ -143,14 +54,6 @@ extension Dictionary where Key == String, Value == Any { ) } - @inlinable - public func getOptionalField(_ key: String) throws -> Field? { - try getOptionalField( - key, - transform: { (dict: Self) in try? T(dictionary: dict) } - ) - } - @inlinable public func getOptionalField( _ key: String, @@ -198,22 +101,6 @@ extension Dictionary where Key == String, Value == Any { }, validator: validator) } - @inlinable - public func getOptionalArray(_ key: String) throws -> Field<[String]>? { - try getOptionalArray( - key, - transform: { $0 as String } - ) - } - - @inlinable - public func getOptionalArray(_ key: String) throws -> Field<[T]>? { - try getOptionalArray( - key, - transform: { (dict: Self) in try T(dictionary: dict) } - ) - } - @inlinable public func getOptionalArray(_ key: String) throws -> Field<[T]>? { try getOptionalArray( @@ -266,32 +153,6 @@ extension Context { return deserializer(dict) } - @inlinable - public func getField( - _ key: String, - validator: AnyValueValidator? = nil, - type: T.Type - ) throws -> T.ResolvedValue { - try templateData.getField( - key, - transform: { deserializeTemplate($0, type: type).value }, - validator: validator - ) - } - - @inlinable - public func getOptionalField( - _ key: String, - validator: AnyValueValidator? = nil, - type: T.Type - ) throws -> T.ResolvedValue? { - try templateData.getOptionalField( - key, - transform: { deserializeTemplate($0, type: type).value }, - validator: validator - ) - } - @inlinable public func getArray( _ key: String, @@ -304,19 +165,6 @@ extension Context { validator: validator ) } - - @inlinable - public func getOptionalArray( - _ key: String, - validator: AnyArrayValueValidator? = nil, - type: T.Type - ) throws -> [T.ResolvedValue]? { - try templateData.getOptionalArray( - key, - transform: { deserializeTemplate($0, type: type).value }, - validator: validator - ) - } } @inlinable diff --git a/TemplatesSupport/TemplateError.swift b/TemplatesSupport/TemplateError.swift index 48ca2d9e..7d6121af 100644 --- a/TemplatesSupport/TemplateError.swift +++ b/TemplatesSupport/TemplateError.swift @@ -1,6 +1,3 @@ -public enum DivError: Error, Equatable { - case generic - case noValueForLink(Link) - case incompatibleValueType(Link, expectedType: String) +enum TemplateError: Error, Equatable { case circularReference([String]) } diff --git a/TemplatesSupport/TemplateToType.swift b/TemplatesSupport/TemplateToType.swift index 69d405f6..94bfcd41 100644 --- a/TemplatesSupport/TemplateToType.swift +++ b/TemplatesSupport/TemplateToType.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import Serialization public typealias TemplateToType = [String: String] @@ -15,7 +15,7 @@ public func calculateTemplateToType(in dict: [String: Any]) -> TemplateToType { for key in unresolved.keys { do { result[key] = try finalType(for: key, in: unresolved) - } catch DivError.circularReference { + } catch TemplateError.circularReference { } catch { assertionFailure() } @@ -29,7 +29,7 @@ private func finalType( analyzedTypes: Set = [] ) throws -> String { guard !analyzedTypes.contains(type) else { - throw DivError.circularReference([type]) + throw TemplateError.circularReference([type]) } guard let next = dict[type] else { @@ -42,7 +42,7 @@ private func finalType( in: dict, analyzedTypes: modified(analyzedTypes) { $0.insert(type) } ) - } catch let DivError.circularReference(stack) { - throw DivError.circularReference([type] + stack) + } catch let TemplateError.circularReference(stack) { + throw TemplateError.circularReference([type] + stack) } } diff --git a/TemplatesSupport/TemplateValue.swift b/TemplatesSupport/TemplateValue.swift index e4fe4578..8ca8d6dd 100644 --- a/TemplatesSupport/TemplateValue.swift +++ b/TemplatesSupport/TemplateValue.swift @@ -1,4 +1,4 @@ -import CommonCore +import CommonCorePublic import Serialization public protocol TemplateValue {