nizzam / Placeholder

Place temporary images in your iOS app showing the size of the available space.

Home Page:https://www.hackingwithswift.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placeholder

Twitter: @twostraws

When you’re busy prototyping an app, it’s helpful to be able to see at a glance what images still need to be filled and what size they are. Placeholder does exactly that: it’s a UIImageView subclass that automatically renders its size along with any title you want.

Placeholder overlays an image’s size and title so you can see exactly what’s missing.

To install, just drag Placeholder.swift into your Xcode project, then change the class of any placeholder image views to be Placeholder rather than UIImageView. When the final artwork arrives, all you need to do is change the class back to UIImageView and you’re back to normal – easy!

Options

There are four properties for Placeholder images that you might want to customize, all of which are exposed to Interface Builder:

  • title lets you add an optional string to be placed above the size, e.g. “User avatar”.
  • textColor lets you adjust the text color used to render the title and size. Defaults to .white.
  • textFontSize lets you adjust the text font size used to render the title and size. Defaults to 20.
  • rounded rounds the corners of the image view using the minimum of the width and height. This creates lozenges in rectangular views and circles in square views.

License

MIT License.

Copyright (c) 2019 Paul Hudson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Place temporary images in your iOS app showing the size of the available space.

https://www.hackingwithswift.com/

License:MIT License


Languages

Language:Swift 100.0%