├── .gitignore
├── .travis.yml
├── Assets
└── Logo.png
├── LICENSE
├── Panda.podspec
├── Panda.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ └── Panda.xcscheme
├── README.md
└── Sources
├── Basics
├── Actions.swift
├── Add.swift
├── Font.swift
├── PandaChain.swift
├── SetHelper.swift
├── SourceDelegate.swift
└── Transform.swift
├── Extensions
├── CALayerExtensions.swift
├── UIAlertControllerExtensions.swift
├── UICollectionViewExtensions.swift
├── UIGestureRecognizerExtensions.swift
├── UILabelExtensions.swift
├── UIScrollViewExtensions.swift
├── UITableViewExtensions.swift
└── UIViewExtensions.swift
├── Info.plist
├── Panda.h
└── Properties
├── QuartzCore
├── CAAnimation.swift
├── CAAnimationGroup.swift
├── CABasicAnimation.swift
├── CADisplayLink.swift
├── CAEAGLLayer.swift
├── CAEmitterCell.swift
├── CAEmitterLayer.swift
├── CAGradientLayer.swift
├── CAKeyframeAnimation.swift
├── CALayer.swift
├── CAMediaTiming.swift
├── CAPropertyAnimation.swift
├── CAReplicatorLayer.swift
├── CAScrollLayer.swift
├── CAShapeLayer.swift
├── CASpringAnimation.swift
├── CATextLayer.swift
├── CATiledLayer.swift
└── CATransition.swift
└── UIKit
├── NSItemProvider.swift
├── NSLayoutConstraint.swift
├── NSLayoutManager.swift
├── NSMutableAttributedString.swift
├── NSMutableParagraphStyle.swift
├── NSObject.swift
├── NSShadow.swift
├── NSStringDrawingContext.swift
├── NSTextAttachment.swift
├── NSTextContainer.swift
├── NSTextStorage.swift
├── UIAccessibilityContentSizeCategoryImageAdjusting.swift
├── UIAccessibilityCustomAction.swift
├── UIAccessibilityCustomRotor.swift
├── UIAccessibilityCustomRotorItemResult.swift
├── UIAccessibilityCustomRotorSearchPredicate.swift
├── UIAccessibilityElement.swift
├── UIAccessibilityIdentification.swift
├── UIActionSheet.swift
├── UIActivityIndicatorView.swift
├── UIActivityViewController.swift
├── UIAlertAction.swift
├── UIAlertController.swift
├── UIAlertView.swift
├── UIApplication.swift
├── UIAttachmentBehavior.swift
├── UIBarButtonItem.swift
├── UIBarButtonItemGroup.swift
├── UIBarItem.swift
├── UIBezierPath.swift
├── UIButton.swift
├── UICloudSharingController.swift
├── UICollectionView.swift
├── UICollectionViewCell.swift
├── UICollectionViewController.swift
├── UICollectionViewFlowLayout.swift
├── UICollectionViewFlowLayoutInvalidationContext.swift
├── UICollectionViewLayoutAttributes.swift
├── UICollectionViewLayoutInvalidationContext.swift
├── UICollectionViewTransitionLayout.swift
├── UICollisionBehavior.swift
├── UIContentSizeCategoryAdjusting.swift
├── UIContextualAction.swift
├── UIControl.swift
├── UIDatePicker.swift
├── UIDevice.swift
├── UIDocument.swift
├── UIDocumentBrowserAction.swift
├── UIDocumentBrowserTransitionController.swift
├── UIDocumentBrowserViewController.swift
├── UIDocumentInteractionController.swift
├── UIDocumentMenuViewController.swift
├── UIDocumentPickerViewController.swift
├── UIDragInteraction.swift
├── UIDragItem.swift
├── UIDragPreviewParameters.swift
├── UIDragSession.swift
├── UIDropInteraction.swift
├── UIDropProposal.swift
├── UIDropSession.swift
├── UIDynamicAnimator.swift
├── UIDynamicItem.swift
├── UIDynamicItemBehavior.swift
├── UIFieldBehavior.swift
├── UIFocusGuide.swift
├── UIFocusItemScrollableContainer.swift
├── UIGestureRecognizer.swift
├── UIGraphicsImageRendererFormat.swift
├── UIGraphicsPDFRendererContext.swift
├── UIGraphicsPDFRendererFormat.swift
├── UIGravityBehavior.swift
├── UIImagePickerController.swift
├── UIImageView.swift
├── UIInputView.swift
├── UIInputViewController.swift
├── UIInterpolatingMotionEffect.swift
├── UIKeyCommand.swift
├── UILabel.swift
├── UILayoutGuide.swift
├── UILocalNotification.swift
├── UILongPressGestureRecognizer.swift
├── UIManagedDocument.swift
├── UIMarkupTextPrintFormatter.swift
├── UIMenuController.swift
├── UIMenuItem.swift
├── UIMotionEffectGroup.swift
├── UIMutableApplicationShortcutItem.swift
├── UIMutableUserNotificationAction.swift
├── UIMutableUserNotificationCategory.swift
├── UINavigationBar.swift
├── UINavigationController.swift
├── UINavigationItem.swift
├── UIPageControl.swift
├── UIPageViewController.swift
├── UIPanGestureRecognizer.swift
├── UIPasteConfiguration.swift
├── UIPasteConfigurationSupporting.swift
├── UIPasteboard.swift
├── UIPencilInteraction.swift
├── UIPercentDrivenInteractiveTransition.swift
├── UIPickerView.swift
├── UIPinchGestureRecognizer.swift
├── UIPopoverBackgroundView.swift
├── UIPopoverController.swift
├── UIPopoverPresentationController.swift
├── UIPresentationController.swift
├── UIPreviewInteraction.swift
├── UIPrintFormatter.swift
├── UIPrintInfo.swift
├── UIPrintInteractionController.swift
├── UIPrintPageRenderer.swift
├── UIPrinterPickerController.swift
├── UIProgressView.swift
├── UIPushBehavior.swift
├── UIRefreshControl.swift
├── UIResponder.swift
├── UIRotationGestureRecognizer.swift
├── UIScreen.swift
├── UIScreenEdgePanGestureRecognizer.swift
├── UIScrollView.swift
├── UISearchBar.swift
├── UISearchController.swift
├── UISegmentedControl.swift
├── UISimpleTextPrintFormatter.swift
├── UISlider.swift
├── UISnapBehavior.swift
├── UISplitViewController.swift
├── UISpringLoadedInteractionContext.swift
├── UISpringLoadedInteractionSupporting.swift
├── UIStackView.swift
├── UIStepper.swift
├── UISwipeActionsConfiguration.swift
├── UISwipeGestureRecognizer.swift
├── UISwitch.swift
├── UITabBar.swift
├── UITabBarController.swift
├── UITabBarItem.swift
├── UITableView.swift
├── UITableViewCell.swift
├── UITableViewController.swift
├── UITableViewHeaderFooterView.swift
├── UITableViewRowAction.swift
├── UITapGestureRecognizer.swift
├── UITextChecker.swift
├── UITextDraggable.swift
├── UITextDropProposal.swift
├── UITextDroppable.swift
├── UITextField.swift
├── UITextInput.swift
├── UITextInputAssistantItem.swift
├── UITextPasteConfigurationSupporting.swift
├── UITextPasteItem.swift
├── UITextView.swift
├── UIToolbar.swift
├── UIVideoEditorController.swift
├── UIView.swift
├── UIViewAnimating.swift
├── UIViewController.swift
├── UIViewControllerPreviewing.swift
├── UIViewPropertyAnimator.swift
├── UIVisualEffectView.swift
├── UIWebView.swift
└── UIWindow.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | ### macOS ###
2 | *.DS_Store
3 | .AppleDouble
4 | .LSOverride
5 |
6 | # Icon must end with two \r
7 | Icon
8 |
9 |
10 | # Thumbnails
11 | ._*
12 |
13 | # Files that might appear in the root of a volume
14 | .DocumentRevisions-V100
15 | .fseventsd
16 | .Spotlight-V100
17 | .TemporaryItems
18 | .Trashes
19 | .VolumeIcon.icns
20 | .com.apple.timemachine.donotpresent
21 |
22 | # Directories potentially created on remote AFP share
23 | .AppleDB
24 | .AppleDesktop
25 | Network Trash Folder
26 | Temporary Items
27 | .apdisk
28 |
29 |
30 | ### Swift ###
31 | # Xcode
32 | #
33 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
34 |
35 | ## Build generated
36 | build/
37 | DerivedData/
38 |
39 | ## Various settings
40 | *.pbxuser
41 | !default.pbxuser
42 | *.mode1v3
43 | !default.mode1v3
44 | *.mode2v3
45 | !default.mode2v3
46 | *.perspectivev3
47 | !default.perspectivev3
48 | xcuserdata/
49 |
50 | ## Other
51 | *.moved-aside
52 | *.xcuserstate
53 |
54 | ## Obj-C/Swift specific
55 | *.hmap
56 | *.ipa
57 | *.dSYM.zip
58 | *.dSYM
59 |
60 | ## Playgrounds
61 | timeline.xctimeline
62 | playground.xcworkspace
63 |
64 | # Swift Package Manager
65 | #
66 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
67 | # Packages/
68 | .build/
69 |
70 | # CocoaPods
71 | #
72 | # We recommend against adding the Pods directory to your .gitignore. However
73 | # you should judge for yourself, the pros and cons are mentioned at:
74 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
75 | #
76 | # Pods/
77 |
78 | # Carthage
79 | #
80 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
81 | # Carthage/Checkouts
82 |
83 | Carthage/Build
84 |
85 | # fastlane
86 | #
87 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
88 | # screenshots whenever they are needed.
89 | # For more information about the recommended setup visit:
90 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
91 |
92 | fastlane/report.xml
93 | fastlane/Preview.html
94 | fastlane/screenshots
95 | fastlane/test_output
96 |
97 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: xcode10.2
3 | env:
4 | - SCHEME="Panda" DESTINATION="platform=iOS Simulator,name=iPhone Xs"
5 | script:
6 | - set -o pipefail
7 | - xcodebuild -scheme "$SCHEME" -destination "$DESTINATION" | xcpretty
8 |
--------------------------------------------------------------------------------
/Assets/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordlessj/Panda/88e08a732197048ac5902a8f31ff84a573a1ddb8/Assets/Logo.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 Javier Zhang (https://wordlessj.github.io/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Panda.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'Panda'
3 | s.version = '2.0.0'
4 | s.summary = 'Create view hierarchies declaratively.'
5 | s.homepage = 'https://github.com/wordlessj/Panda'
6 | s.license = { :type => 'MIT', :file => 'LICENSE' }
7 | s.author = 'Javier Zhang'
8 | s.source = { :git => 'https://github.com/wordlessj/Panda.git', :tag => s.version.to_s }
9 | s.swift_version = '5.0'
10 |
11 | s.ios.deployment_target = '8.0'
12 |
13 | s.source_files = 'Sources/**/*.swift'
14 | end
15 |
--------------------------------------------------------------------------------
/Panda.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Panda.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Panda.xcodeproj/xcshareddata/xcschemes/Panda.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Sources/Basics/PandaChain.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PandaChain.swift
3 | // Panda
4 | //
5 | // Copyright (c) 2017 Javier Zhang (https://wordlessj.github.io/)
6 | //
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy
8 | // of this software and associated documentation files (the "Software"), to deal
9 | // in the Software without restriction, including without limitation the rights
10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | // copies of the Software, and to permit persons to whom the Software is
12 | // furnished to do so, subject to the following conditions:
13 | //
14 | // The above copyright notice and this permission notice shall be included in
15 | // all copies or substantial portions of the Software.
16 | //
17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | // THE SOFTWARE.
24 | //
25 |
26 | import Foundation
27 |
28 | func unbox- (_ item: Item) -> Target {
29 | if let chain = item as? PandaChainProtocol {
30 | return chain.anyObject as! Target
31 | } else {
32 | return item as! Target
33 | }
34 | }
35 |
36 | func unbox
- (_ item: Item?) -> Target? {
37 | return item.map { unbox($0) }
38 | }
39 |
40 | func unboxArray(_ items: [Any]) -> [Target] {
41 | return items.map { unbox($0) }
42 | }
43 |
44 | func unboxArray(_ items: [Any]?) -> [Target]? {
45 | return items.map { unboxArray($0) }
46 | }
47 |
48 | public protocol PandaChainProtocol {
49 | var anyObject: Any { get }
50 | }
51 |
52 | public class PandaChain