Swiftpack.co -  sweetmans/InstagramPhotos as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
sweetmans/InstagramPhotos
InstagramPhotos, An instagram photos picker with same design.
.package(url: "https://github.com/sweetmans/InstagramPhotos.git", from: "v2.0.0")

Version License Platform Reviewed by Hound

To be contributed with me

Twitter PM me Twitter

The latest MAJOR release: 2.0.0 RELEASENOTE.md

  • ☑ Rename to InstagramPhotos
  • ☑ Migrated to Xcode 12
  • ☑ New UI design same with instagram
  • ☑ Adding localization support
  • ☑ Supporting new iOS 14 photos limited access system

The latest release 2.0.3 Latest RELEASENOTE.md

TO DO

  • ☐ Adding filter function SMIIP-9
  • ☐ Multiples photos select support SMIIP-10
  • ☐ Create iOS code checking SMIIP-3
  • ☐ New design for iPad support SMIIP-8

If you like this framework. Please give me a star ⭐️

Contributor

Welcome to be one of us 🧑🏻‍💻🧑‍💻🧑🏼‍💻🧑🏽‍💻🧑🏾‍💻🧑🏿‍💻

Features

  • ☑ New UI design same with instagram
  • ☑ Adding localization support
  • ☑ Supporting new iOS 14 photos limited access system
  • ☑ So easy to use.
  • ☑ Support Swift 5.0 and above
  • ☑ Performances!
  • ☑ Use GCD and ARC
  • ☑ Supported iOS 11.0 and above

Requirements

  • iOS 12.0 or later
  • Xcode 12.0 or later
  • swift 5.0 or later

Getting Started

Installation

SMInstagramPhotoPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

Cocoapods

pod 'InstagramPhotos'

Swift Package Manager (Bundle issue could not use swift package right now)

dependencies: [
    .package(url: "https://github.com/sweetmans/InstagramPhotos.git", .upToNextMajor(from: "2.0.0"))
]

And Then.

import InstagramPhotos

Usage

In your ViewController.

var picker: InstagramPhotosPickingViewController?

Photo library access

First. It is importance to do this step. Be sour your app have Authorization to access your photo library. on your plist.info adding this attribute

<key>NSPhotoLibraryUsageDescription</key>
<string>Your app need access your photo library</string>

if iOS 14 you need to set PHPhotoLibraryPreventAutomaticLimitedAccessAlert to YES on plist.info to prevent limited photos access alert.

<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
<true/>

Initialize your photo Pinking View Controller

private func getPickerReady() {
    picker = InstagramPhotosPickingViewController(imagePicking: self,
                                         ocalizationsProviding: InstagramPhotosChineseLocalizationProvider())
}

Present the pickingViewController

@IBAction func show(_ sender: UIButton) {
    guard let unwrapPicker = picker else { return }
    unwrapPicker.modalPresentationStyle = .fullScreen
    present(unwrapPicker, animated: true, completion: nil)
}

Get your image through InstagramPhotosPicking delegate.

extension ViewController: InstagramPhotosPicking {
    //your viewcontroller
    func instagramPhotosDidFinishPickingImage(result: InstagramPhotosPickingResult) {
        switch result {
        case .failure(let error):
            switch error {
            case .cancelByUser:
                print("User canceled selete image")
            default:
                print(error)
            }
        case .success(let ipImage):
            viewController.imageView.image = ipImage.image
        }
    }
}

Customize Localization

You could use default InstagramPhotosChineseLocalizationProvider() for English, InstagramPhotosEnglishLocalizationProvider() for Chinese.

define you own localization provider

// Exsample Korean
struct KoreanLocalizationProvider: InstagramPhotosLocalizationsProviding {
    public init() {}
    public func pinkingControllerNavigationTitle() -> String {  return "사진 선택" }
    public func pinkingControllerNavigationNextButtonText() -> String { return "다음 단계" }
    public func pinkingControllerDefaultAlbumName() -> String { return "사진 갤러리" }
    public func pinkingControllerAddingImageAccessButtonText() -> String { return "접근 가능한 사진 추가" }
    public func albumControllerNavigationTitle() -> String { return "앨범 선택" }
    public func albumControllerNavigationCancelButtonText() -> String { return "취소" }
    public func photosLimitedAccessModeText() -> String { return "액세스 권한이있는 모든 사진이 표시됩니다" }
}

Apply it in the pickingViewController Initialize

private func getPickerReady() {
    let imageProvider = PhotosProvider(viewController: self)
    picker = InstagramPhotosPickingViewController(imagePicking: imageProvider,
                                        localizationsProviding: KoreanLocalizationProvider())
}

Licenses

All source code is licensed under the MIT License.

About

  • ☑ Powered by SWEETMAN,INC on 2021
  • ☑ GUANGZHOU CN 510000
  • www.sweetman.cc

GitHub

link
Stars: 7
Last commit: 3 weeks 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

Release v2.0.3
3 weeks ago

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