Latest | 0.1.0 |
---|---|
Homepage | https://github.com/FarisAlbalawi/FAStickers |
License | MIT |
Platforms | ios 11.0 |
Frameworks | UIKit, MapKit |
Authors |
Features
- Supports Stickers
- Supports Emojis
- Supports Gifs
- Swift 5
Requirements
- iOS 11.0 and later
- swift 5
Installation
FAStickers is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'FAStickers'
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
import FAStickers
import UIKit
class ViewController: UIViewController{
var StickerVC: StickerViewController!
public var stickers : [String] = []
public var gifs : [String] = []
}
override func viewDidLoad() {
super.viewDidLoad()
// append stickers
for i in 100...110 {
stickers.append(i.description)
}
let gifImage = ["gif1","gif2","gif3","gif4", "gif5","gif6","gif7","gif8", "gif9"]
// append gitf
for i in gifImage {
gifs.append(i)
}
StickerVC = StickerViewController(nibName: nil, bundle: Bundle(for: StickerViewController.self))
}
@IBAction func AddSticker(_ sender: Any) {
showStickerView()
}
}
extension ViewController: StickerEmojiDelegate {
func GitTapped(GifName: String) {
print(GifName)
let Gif = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
Gif.loadGif(name: GifName)
Gif.contentMode = .scaleAspectFit
Gif.center = view.center
self.view.addSubview(Gif)
self.removeStickerView()
}
func EmojiTapped(EmojiName: String) {
print(EmojiName)
var emojiView = UIView()
let emojiLabel = UILabel(frame: CGRect(x: 0, y: 0, width: 70, height: 70))
emojiLabel.text = EmojiName
emojiLabel.font = UIFont.systemFont(ofSize: 50)
emojiView = emojiLabel
emojiView.center = view.center
self.view.addSubview(emojiView)
self.removeStickerView()
}
func StickerTapped(StickerName: String) {
print(StickerName)
let Sticker = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
Sticker.image = UIImage(named: StickerName)
Sticker.contentMode = .scaleAspectFit
Sticker.center = view.center
self.view.addSubview(Sticker)
self.removeStickerView()
}
func showStickerView() {
StickerVC.stickerDelegate = self
// append gifs
for gifImage in self.gifs {
StickerVC.gits.append(gifImage)
}
// append stickers
for stickersImage in self.stickers {
StickerVC.stickers.append(stickersImage)
}
self.addChild(StickerVC)
self.view.addSubview(StickerVC.view)
StickerVC.didMove(toParent: self)
let height = view.frame.height
let width = view.frame.width
StickerVC.view.frame = CGRect(x: 0, y: self.view.frame.maxY , width: width, height: height)
}
func removeStickerView() {
UIView.animate(withDuration: 0.3,
delay: 0,
options: UIView.AnimationOptions.curveEaseIn,
animations: { () -> Void in
var frame = self.StickerVC.view.frame
frame.origin.y = UIScreen.main.bounds.maxY
self.StickerVC.view.frame = frame
}, completion: { (finished) -> Void in
self.StickerVC.view.removeFromSuperview()
self.StickerVC.removeFromParent()
})
}
}
Delegate:
StickerEmojiDelegate
func EmojiTapped(EmojiName: String)
func StickerTapped(StickerName: String)
func GitTapped(GifName: String)
Author
Faris Albalawi,
[email protected]
License
FAStickers is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "FAStickers", "version": "0.1.0", "swift_version": "5", "summary": "FAStickers allows you to create easily Stickers, Emojis, and Gifs", "description": "'FAStickers allows you to create easily Stickers, Emojis, and Gif that you can use it for Photo Editor like the SnapChat app when you add a Stickers on images, etc, or you can use it in chat to send a Stickers, Emojis or even a Gif message, etc. '.", "homepage": "https://github.com/FarisAlbalawi/FAStickers", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "Faris Albalawi": "[email protected]" }, "source": { "git": "https://github.com/FarisAlbalawi/FAStickers.git", "tag": "0.1.0" }, "platforms": { "ios": "11.0" }, "source_files": "FAStickers/Classes/*.swift", "frameworks": [ "UIKit", "MapKit" ] }
Wed, 05 Jun 2019 10:21:08 +0000