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
- Support Swift package SMIIP-12
- Adding filter function SMIIP-9
- Multiples photos select support SMIIP-10
- Create iOS code checking SMIIP-3
- New design for iPad support SMIIP-8
- 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
- iOS 12.0 or later
- Xcode 12.0 or later
- swift 5.0 or later
SMInstagramPhotoPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'InstagramPhotos'
dependencies: [
.package(url: "https://github.com/sweetmans/InstagramPhotos.git", .upToNextMajor(from: "2.0.0"))
]
import InstagramPhotos
var picker: InstagramPhotosPickingViewController?
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/>
private func getPickerReady() {
picker = InstagramPhotosPickingViewController(imagePicking: self,
ocalizationsProviding: InstagramPhotosChineseLocalizationProvider())
}
@IBAction func show(_ sender: UIButton) {
guard let unwrapPicker = picker else { return }
unwrapPicker.modalPresentationStyle = .fullScreen
present(unwrapPicker, animated: true, completion: nil)
}
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
}
}
}
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())
}
All source code is licensed under the MIT License.
- Powered by SWEETMAN,INC on 2021
- GUANGZHOU CN 510000
- www.sweetman.cc