https://github.com/jndisrupter/jnmultipleimages
Multiple images view
https://github.com/jndisrupter/jnmultipleimages
aspectfill cocoapods count-label image multiple-imageview newsfeed-images post-images stacked-images swift xcode
Last synced: 20 days ago
JSON representation
Multiple images view
- Host: GitHub
- URL: https://github.com/jndisrupter/jnmultipleimages
- Owner: JNDisrupter
- License: mit
- Created: 2017-09-13T15:36:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T09:06:29.000Z (over 1 year ago)
- Last Synced: 2025-04-11T17:10:34.603Z (11 months ago)
- Topics: aspectfill, cocoapods, count-label, image, multiple-imageview, newsfeed-images, post-images, stacked-images, swift, xcode
- Language: Swift
- Homepage:
- Size: 3.07 MB
- Stars: 8
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JNMultipleImages
[](https://travis-ci.org/JNDisrupter/JNMultipleImages)
[](http://cocoapods.org/pods/JNMultipleImages)
[](http://cocoapods.org/pods/JNMultipleImages)
[](http://cocoapods.org/pods/JNMultipleImages)
**JNMultipleImages** can be used to display multiple images in single view, it can be used in a newsfeed or posts. A single post can contain up to 4 displayed images, while showing a number with the remaining images if they are more than 4.
## Preview

## Requirements
- iOS 12.0+ / macOS 15.7+
- Xcode 26+
- Swift 5.10+
## Installation with Swift Package Manager
JNMultipleImages support SwiftPM. To use SwiftPM, you should use Xcode 26 to open your project. Click `File` -> `Swift Packages` -> `Add Package Dependency`, enter [JNMultipleImages repo's URL](https://github.com/JNDisrupter/JNMultipleImages.git)
## Usage
#### To add JNMultipleImages in interface builder:
1. Put some UIView and change the class to "JNMultipleImages"
2. Add refrence for it in the view controller.
3. Change Attributes:
* You can change count label attributes by accessing it directly from the JNMultipleImages reference.
* delegate : this delegate confirm to JNMultipleImagesViewDelegate.
4. Call setup method:
Setup with JNImage array
```swift
setup(images: [JNImage], countLabelPosition: JNMultipleImagesCountLabelPosition = JNMultipleImagesCountLabelPosition.lastItem, placeHolderImage: UIImage? = nil, itemsMargin : CGFloat = 2.0, style: JNMultipleImagesView.style = .collection, cornerRadius: CGFloat = 0)
```
Setup with array of any which might be Url String or UIImage
```swift
func setup(images: [Any], countLabelPosition: JNMultipleImagesCountLabelPosition = JNMultipleImagesCountLabelPosition.lastItem, placeHolderImage: UIImage? = nil, itemsMargin: CGFloat = 2.0, style: JNMultipleImagesView.style = .collection, cornerRadius: CGFloat = 0)
```
##### parameters
* images : The images array to load.
* countLabelPosition : The position for the count label (Fill view or fill last item).
* placeHolderImage : The placeholder image to use for failed images.
* itemsMargin : The margin between items.
* style : The style of the view, it can be collection or a stack(horizental).
* cornerRadius : corner radius for images.
> The library will adjust the UIImageViews content mode automatically like the follows :
> * If the image dimensions is smaller than the image view dimensions then the content mode is aspectFill
> * If image width and height ratio less than the image view width and height ration then the content mode is aspectFill
> * If the image is landscape and the image height is less than the image view height then the content mode is topRight
> * Other than this it is aspectFit.
## Authors
Jayel Zaghmoutt & Mohammad Nabulsi
## License
JNMultipleImages is available under the MIT license. See the [LICENSE](https://github.com/JNDisrupter/JNMultipleImages/blob/master/LICENSE) file for more info.