Swiftpack.co -  heroesofcode/MagicImages as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
heroesofcode/MagicImages
Magic Image is a library to facilitate the development of the image in various ways.
.package(url: "https://github.com/heroesofcode/MagicImages.git", from: "0.0.3")

Magic Images

CI codecov Swift Version SPM compatible License

Overview

Magic Image is a library to facilitate the development of the image in various ways.

How to use?

First Example

You can use it to view an image through a url, follow the example below

let photo: UIImageView = {
    let imageView = UIImageView()
    imageView.translatesAutoresizingMaskIntoConstraints = false
    return imageView
}()

override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(photo)

    photo.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    photo.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
    photo.widthAnchor.constraint(equalToConstant: 100).isActive = true
    photo.heightAnchor.constraint(equalToConstant: 100).isActive = true

    MagicImages(image: photo).start(url: "IMAGE URL")
}

Second Example

You can use it to view a circular image. Measure is the width and height, follow the example below

let photo: UIImageView = {
    let imageView = UIImageView()
    imageView.translatesAutoresizingMaskIntoConstraints = false
    return imageView
}()

override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(photo)

    photo.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    photo.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true

    MagicImages(image: photo).start(url: "IMAGE URL").isCircle(measure: 100)
}

Third Example

You can use it to see an image with rounded edges. Measure is rounded edges, follow the example below

let photo: UIImageView = {
    let imageView = UIImageView()
    imageView.translatesAutoresizingMaskIntoConstraints = false
    return imageView
}()

override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(photo)

    photo.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    photo.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
    photo.widthAnchor.constraint(equalToConstant: 300).isActive = true
    photo.heightAnchor.constraint(equalToConstant: 200).isActive = true
        
    MagicImages(image: photo).start(url: "IMAGE URL").isRounded(measure: 20)
}

Last Example

You can use it to see an image with some sides of the rounded edges. Measure is rounded edges, follow the example below

let photo: UIImageView = {
        let imageView = UIImageView()
        imageView.translatesAutoresizingMaskIntoConstraints = false
        return imageView
 }()

override func viewDidLoad() {
    super.viewDidLoad()

    view.addSubview(photo)

    photo.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
    photo.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
    photo.widthAnchor.constraint(equalToConstant: 300).isActive = true
    photo.heightAnchor.constraint(equalToConstant: 200).isActive = true
        
    MagicImages(image: photo).start(url: "IMAGE URL")
            .isSides(measure: 50, mask: [.layerMaxXMaxYCorner, .layerMinXMinYCorner])
}

Installation

dependencies: [
    .package(url: "https://github.com/heroesofcode/MagicImages.git", .upToNextMajor(from: "0.0.2"))
]
import MagicImages

Author

Coded by @joaolfp

License

MIT License

Copyright (c) 2021 Heroes of Code

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.

GitHub

link
Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4 weeks ago

Features

  • Now the framework is more secure, continuous integration has been added to build and verify the tests.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API