All Projects → paulz → Imagecoordinatespace

paulz / Imagecoordinatespace

Licence: mit
UICoordinateSpace for UIImageView image

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Imagecoordinatespace

Hero
Elegant transition library for iOS & tvOS
Stars: ✭ 20,547 (+48821.43%)
Mutual labels:  xcode, carthage
Swiftinstagram
Instagram API client written in Swift
Stars: ✭ 570 (+1257.14%)
Mutual labels:  xcode, carthage
Xcov
Nice code coverage reporting without hassle
Stars: ✭ 467 (+1011.9%)
Mutual labels:  xcode, coverage
Playground
Instantly create Swift playgrounds from the command line
Stars: ✭ 391 (+830.95%)
Mutual labels:  xcode, playground
Xcodecoverage
Code coverage for Xcode projects (Objective-C only)
Stars: ✭ 818 (+1847.62%)
Mutual labels:  xcode, coverage
Gradientcircularprogress
Customizable progress indicator library in Swift
Stars: ✭ 407 (+869.05%)
Mutual labels:  xcode, carthage
Swiftysound
SwiftySound is a simple library that lets you play sounds with a single line of code.
Stars: ✭ 995 (+2269.05%)
Mutual labels:  xcode, carthage
Maplebacon
🍁🥓 Lightweight and fast Swift library for image downloading, caching and transformations
Stars: ✭ 322 (+666.67%)
Mutual labels:  xcode, carthage
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+1830.95%)
Mutual labels:  xcode, carthage
Whats New In Swift 5 0
An Xcode playground that demonstrates the new features introduced in Swift 5.0.
Stars: ✭ 703 (+1573.81%)
Mutual labels:  xcode, playground
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (+830.95%)
Mutual labels:  xcode, carthage
Swiftlyext
SwiftlyExt is a collection of useful extensions for Swift 3 standard classes and types 🚀
Stars: ✭ 31 (-26.19%)
Mutual labels:  xcode, carthage
Restofire
Restofire is a protocol oriented networking client for Alamofire
Stars: ✭ 377 (+797.62%)
Mutual labels:  xcode, carthage
Uitextfield Navigation
🏄‍♂️ UITextField-Navigation makes it easier to navigate between UITextFields and UITextViews
Stars: ✭ 436 (+938.1%)
Mutual labels:  xcode, carthage
Tbuiautotest
Generating UI test label automatically for iOS.
Stars: ✭ 333 (+692.86%)
Mutual labels:  xcode, carthage
Playalways
Create Xcode playgrounds from your menu bar
Stars: ✭ 515 (+1126.19%)
Mutual labels:  xcode, playground
Microfeatures Guidelines
📦📝 uFeatures guidelines
Stars: ✭ 315 (+650%)
Mutual labels:  xcode, carthage
Datepickercell
📅 Inline/Expanding date picker for table views.
Stars: ✭ 315 (+650%)
Mutual labels:  carthage, cocoapod
Sidemenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.
Stars: ✭ 5,267 (+12440.48%)
Mutual labels:  xcode, carthage
Quiver
Validation, searching and filtering made easy for swift.
Stars: ✭ 27 (-35.71%)
Mutual labels:  xcode, carthage

Image Coordinate Space

UICoordinateSpace for UIImageView image

Build Status codecov Depfu

Swift Version License Platform Carthage compatible

Usage

Convert CGPoint from image coordinates to view coordinates:

import ImageCoordinateSpace

let imageSpace = imageView.contentSpace()
let imageTopLeft = imageSpace.convert(CGPoint.zero, to: imageView)

Convert CGPoint from view coordinates to image coordinates:

let viewTopLeft = imageSpace.convert(CGPoint.zero, from: imageView)

Similar conversions are available for CGRect:

let imageRect = CGRect(x: 321, y: 102, width: 63, height: 64)
let viewRect = imageSpace.convert(imageRect, to: imageView)

and from view coordinates to image coordinates:

let viewRect = CGRect(x: 107, y: 68, width: 21, height: 42.667)
let imageRect = imageSpace.convert(viewRect, from: imageView)

Examples

Add positioned image overlay

Open included Xcode Example project to see Xcode Playground: Example/Visual.playground

Demonstrate image ovelay placement

Converting image face detection regions to view touch points

Other uses from popular Stackoverflow questions:

Documentation

HeaderDoc is included, see UIImageView+UICoordinateSpace.swift

Installation

CocoaPods

  • add the following line to your Podfile:

pod 'ImageCoordinateSpace'

  • run pod install

Carthage

  • add to your Cartfile:

    github "paulz/ImageCoordinateSpace"

  • run carthage update

  • link your app with ImageCoordinateSpace.framework from Carthage/Build/iOS folder

Unit tests

To run included unit tests install dependencies via Carthage:

carthage bootstrap

Run tests:

xcodebuild test -scheme ImageCoordinateSpace -destination 'platform=iOS Simulator,name=iPhone X'

See them pass at lightning speed:

Test Suite 'All tests' passed at 2017-12-13 08:07:14.826.
Executed 36 tests, with 0 failures (0 unexpected) in 0.013 (0.023) seconds
** TEST SUCCEEDED **

Author

Paul Zabelin, https://github.com/paulz

License

ImageCoordinateSpace is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].