Latest 0.1.0
Homepage https://github.com/Kinpil/Swiftor
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Swiftor
Swiftor

If you want simple code example, download this Git and open the example project

Requirements

iOS 8 and above

Installation

Right now, there is no manual install. But there will be one soon!

You could install with cocoapods which is recomended for the ease of updating the framework

To install Swiftor with Cocoapods, simply add the following line to your Podfile:

pod 'Swiftor', :git => 'https://github.com/Kinpil/Swiftor.git', :branch => 'master'

Then add this to the top of your Swift file

import Swiftor

Usage

For the selectors in this remember to use

#selector(ViewController.function)

instead of

"function"

Downloading images in the background with the DownloadImageInBackground function allows you to set an ImageView’s image to the image from a URL. This is good when you are trying to load multiple images at the same time and/or with a slow connection.

Download images in the background like this:

let imagView = UIImageView()
imageView.downloadImageInBackgroundFrom(url: "https://c1.staticflickr.com/9/8661/15619986024_fb86f66876_z.jpg")

Or just download an image the normal way, just way easier

let imageView = UIImageView()
imageView.downloadImageFrom(url: "https://c1.staticflickr.com/9/8661/15619986024_fb86f66876_z.jpg")

Posting and Observing notifications are now easier.

To post a notificaiton do this:

NotificationCenter.default.postNoticationWith(name: "exampleNotification")

To observe a notification do this:

NotificationCenter.default.listenFor(notification: "exampleNotification", self, selector: #selector(ViewController.listenToNotification))

Its now also easier to make rounded corners on ImageViews. (Will support more types of views soon)

To put rounded corners do this:

let imageView = UIImageView()
imageView.makeRoundedCorners(multiplier: 20)

You could also check if headphones are plugged in and/or a bluetooth audio source is connected

For headphones do this:

if isHeadsetPluggedIn() {
    // Headphones are connected
}

For bluetooth do this:

if bluetoothAudioConnected() {
    // A Bluetooth audio source is connected
}

Finally, a better way to change the width and height of a view

To change the width and height do this:

exampleView.setWidth(50)
exampleView.setHeight(with: 50) // TODO: make this function not require "with"

You could also see which device the user uses the, from iPhone 7+ and below. But is updated regularly

To get the current device you use this:

UIDevice.current.modelName // Returns a string of an easier recognized name such as "iPhone 7 Plus"

It is possible to detect if a color is dark or bright

To detect if a color is dark or bright do this:

if readableForegroundColor(forBackgroundColor: self.view.backgroundColor!) == UIColor.white {
    // Color Is Bright
} else {
    // Color Is Dark
}

Lastly, you could randomize an array of anything to a random order

To randomize an array do this:

var numberArrayRaw = [1, 2, 3, 4, 5] // 1 2 3 4 5
numberArrayRaw.randomize() // 5 3 1 2 4

Have any suggestions? Email me and I’ll add them!

Author

Kinpil, [email protected]

License

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

Latest podspec

{
    "name": "Swiftor",
    "version": "0.1.0",
    "summary": "Make Swift Better",
    "description": "This could be used to adding motion effects to views to faster image downloading so the developers do not have to do it",
    "homepage": "https://github.com/Kinpil/Swiftor",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kinpil": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Kinpil/Swiftor.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Swiftor/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This