{"id":1530,"url":"https://github.com/TileImageTeamiOS/THTiledImageView","last_synced_at":"2025-08-02T04:32:04.498Z","repository":{"id":56922837,"uuid":"116630031","full_name":"TileImageTeamiOS/THTiledImageView","owner":"TileImageTeamiOS","description":"High Quality Image ScrollView using cropped tiled images.","archived":false,"fork":false,"pushed_at":"2018-02-25T12:05:57.000Z","size":20422,"stargazers_count":30,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-21T11:27:50.515Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TileImageTeamiOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-08T04:33:16.000Z","updated_at":"2025-01-04T03:10:40.000Z","dependencies_parsed_at":"2022-08-21T04:50:27.961Z","dependency_job_id":null,"html_url":"https://github.com/TileImageTeamiOS/THTiledImageView","commit_stats":null,"previous_names":["tileimageteamios/storytellingkit"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/TileImageTeamiOS/THTiledImageView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TileImageTeamiOS%2FTHTiledImageView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TileImageTeamiOS%2FTHTiledImageView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TileImageTeamiOS%2FTHTiledImageView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TileImageTeamiOS%2FTHTiledImageView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TileImageTeamiOS","download_url":"https://codeload.github.com/TileImageTeamiOS/THTiledImageView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TileImageTeamiOS%2FTHTiledImageView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334615,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:49.046Z","updated_at":"2025-08-02T04:32:00.745Z","avatar_url":"https://github.com/TileImageTeamiOS.png","language":"Swift","funding_links":[],"categories":["Media"],"sub_categories":["Image"],"readme":"#  THTiledImageView\n\n[![Build Status](https://travis-ci.org/TileImageTeamiOS/THTiledImageView.svg?branch=master)](https://travis-ci.org/TileImageTeamiOS/THTiledImageView)\n[![Code Coverage](https://codecov.io/gh/TileImageTeamiOS/THTiledImageView/branch/master/graphs/badge.svg)](https://codecov.io/gh/TileImageTeamiOS/THTiledImageView)\n[![Version](https://cocoapod-badges.herokuapp.com/v/THTiledImageView/badge.png)](https://github.com/TileImageTeamiOS/THTiledImageView)\n[![platform](https://cocoapod-badges.herokuapp.com/p/THTiledImageView/badge.png)](https://github.com/TileImageTeamiOS/THTiledImageView)\n[![License](https://cocoapod-badges.herokuapp.com/l/THTiledImageView/badge.png)](https://github.com/TileImageTeamiOS/THTiledImageView)\n[![Swift 4.0](https://img.shields.io/badge/Swift-4.0-%23FB613C.svg)](https://developer.apple.com/swift/)\n\n\n## Feature\n\n- [x] 🖼 `THTiledImageView` fully support `UIScrollView`. You can subclass it and use it.\n- [x] 📡 Support Async Image Downloading \u0026 Caching.\n- [x] 🔍 You can set different tiled images based on user's zoom scale.\n- [x] 🔪 Support Image Cutting Extension Method to generate tiled images.\n\n## Demo\n\n![THTileImageView](images/THTileImageView.gif)\n\n## Installation\n\n### CocoaPods\n\nYou can install the latest release version of CocoaPods with the following command\n\n```bash\n$ gem install cocoapods\n```\n\nSimply add the following line to your Podfile:\n\n```ruby\npod \"Kingfisher\"\npod \"THTiledImageView\"\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n## Requirements\n\n`THTiledImageView` is written in Swift 4, and compatible with iOS 9.0+. We use [Kingfisher](https://github.com/onevcat/Kingfisher) library for image downloading and caching. So you need to install `Kingfisher` also to use `THTiledImageView`.\n\n## How to use\n\n1. `THTiledImageScrollView` is subclass of UIScrollVIew. Create `THTiledImageScrollView` from Storyboard or programmatically.\n\n```Swift\nclass ViewController: UIViewController {\n    @IBOutlet weak var tileImageScrollView: THTiledImageScrollView!\n}\n```\n\n2. Create dataSource class that conforms `THTiledImageViewDataSource`.\n\n```Swift\nclass ViewController: UIViewController {\n    @IBOutlet weak var tileImageScrollView: THTiledImageScrollView!\n\n    var dataSource: THTiledImageViewDataSource?\n}\n```\n\n3. Here is `THTiledImageViewDataSource` options that you can use.\n\n```Swift\nfunc setupExample(tileImageBaseURL: URL, imageSize: CGSize, tileSize: [CGSize], thumbnail: URL) {\n\n    dataSource = MyTileImageViewDataSource(tileImageBaseURL: tileImageBaseURL, imageSize: imageSize, tileSize: tileSize)\n\n    guard let dataSource = dataSource else { return }\n\n    dataSource.thumbnailImageName = \"bench\"\n\n    // User can see this level of tiles when they zoom in the image\n    dataSource.maxTileLevel = 3\n\n    // User can see this level of tiles when they zoom out the image\n    dataSource.minTileLevel = 1\n\n    // Allowable maximum level of scrollView zoom\n    dataSource.maxZoomLevel = 8\n\n    dataSource.imageExtension = \"jpg\"\n\n    // Local Image For Background\n    dataSource.setBackgroundImage(url: thumbnail)\n\n    // Remote Image For Background\n    dataSource.backgroundImageURL = URL(string: \"Image URL goes here\")\n    dataSource.requestBackgroundImage { _ in }\n\n    // size of scrollView Frame\n    dataSource.scrollViewSize = setScrollViewSize()\n\n    tileImageScrollView.set(dataSource: dataSource)\n}\n```\n\n### Async Image Downloading \u0026 Caching\n\nFrom Version 0.3.0, We support setting tile image from remote server.\n\n- Set the base URL that you want to download image, and set the `accessFromServer` option to `true`.\n\n```Swift\ndataSource.tileImageBaseURL = URL(string: \"http://127.0.0.1:5000\")\ndataSource.accessFromServer = true\n```\n\n- Put tiled images on your Server. Take a look at our [image path rules](https://github.com/TileImageTeamiOS/THTiledImageView/tree/update-readme#tiled-images-path) to use downloading.\n\n### Zoom and Tile Level\n\n`THTiledImageView`'s zoom level and tile level can be set separately.\n\n#### Zoom Level\n\nUIScrollView's Zoom level. Default `minimum zoom level` is scale aspect fit size of scrollView. `maximum zoom level` is allowable zoom in level.\n\n#### Tile Level\n\nTiled images can be shown at specific zoom level based on tile level. For example, if you set `(minTileLevel, maxTileLevel) = (1, 5)`, You can set 5 different images by tile level.\n\nTile level 1 can be used wide range of image.\n\n\u003cimg src=\"images/example_level_1.png\" style=\"max-width: 50%\"\u003e\n\nTile level 5(or more than 1) can be used narrow range of image.\n\n\u003cimg src=\"images/example_level_5.png\" style=\"max-width: 50%\"\u003e\n\n\n### Cutting Image\n\n\u003e ❗️ Cutting and rendering images cannot be done simultaneously. You should cut images first(from another viewController), and render the image.\n\nWe offer you image cutting function(`UIImage.saveTileOf(size:name:withExtension:)`. Specify the size of tiles by levels.\n\n```Swift\n// size and level will be 512-1, 256-2, 128-3(size-level).\nlet tiles: [CGSize] = [CGSize(width: 512, height: 512),\n                       CGSize(width: 256, height: 256), CGSize(width: 128, height: 128)]\n\n// static function\nUIImage.saveTileOf(size: tiles, name: \"bench\", withExtension: \"jpg\")\n```\n\n#### Tiled Images path\n\nTiled images will be saved on your cache directory. Path of the cache directory:\n\n```Swift\nlet cachesPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true)[0] as String\n```\n\nIf imagefile saved successfully, you can see images from cache directory. Here is the rule of directory path and image file name rules.\n\n```\nPath Rules ./imageName/imageSize/{imageName_imageSize_level_x_y}.jpg\nExample    ./bench/256/bench_256_1_0_0.jpg\n```\n\n\u003e ❗️ If you create images on your own, you need to obey the path rules to use `THTileImageView`.\n\n#### Tiled Images path For Server\n\n1. Put tiles on your server. path of image should looks like this.\n\n```\nhttp://127.0.0.1:5000/bench/256/bench_256_1_0_0.jpg\n```\n\nAll you need to do is go to the cache directory and take out and put that directory to your server.\n\n### THTiledImageScrollViewDelegate\n\nYou can use `UIScrollViewDelegate` methods from `THTiledImageScrollViewDelegate`.\n\n```Swift\npublic protocol THTiledImageScrollViewDelegate: class {\n    func didScroll(scrollView: THTiledImageScrollView)\n    func didZoom(scrollView: THTiledImageScrollView)\n}\n```\n\nSee our example for more details.\n\n## License\n\n`THTiledImageView` is released under the MIT license. [See LICENSE](https://github.com/TileImageTeamiOS/THTiledImageView/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTileImageTeamiOS%2FTHTiledImageView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTileImageTeamiOS%2FTHTiledImageView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTileImageTeamiOS%2FTHTiledImageView/lists"}