diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c422b07..b6d2ed6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,16 +12,16 @@ env: jobs: test: - name: Test on iOS + name: Test on iOS runs-on: macos-latest - + strategy: matrix: destination: - - "OS=18.0,name=iPhone 15" - - "OS=17.4,name=iPhone 14" - - "OS=16.4,name=iPhone 12" - + - "OS=18.5,name=iPhone 16 Pro" + - "OS=18.5,name=iPhone 16" + - "OS=18.5,name=iPhone SE (3rd generation)" + steps: - name: Checkout uses: actions/checkout@v4 @@ -29,7 +29,7 @@ jobs: - name: Setup Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '16.4' + xcode-version: '16.0' - name: Install xcpretty run: gem install xcpretty @@ -40,57 +40,18 @@ jobs: - name: Show available simulators run: xcrun simctl list devices available - - name: Build and Test Framework (Debug) + - name: Build Swift Package for iOS run: | set -o pipefail - xcodebuild -workspace "iOS Example/iOS Example.xcworkspace" \ - -scheme "FDTake" \ - -destination "${{ matrix.destination }}" \ - -configuration Debug \ - ONLY_ACTIVE_ARCH=NO \ - ENABLE_TESTABILITY=YES \ - test | xcpretty - - - name: Build and Test Framework (Release) - run: | - set -o pipefail - xcodebuild -workspace "iOS Example/iOS Example.xcworkspace" \ - -scheme "FDTake" \ - -destination "${{ matrix.destination }}" \ - -configuration Release \ - ONLY_ACTIVE_ARCH=NO \ - ENABLE_TESTABILITY=YES \ - test | xcpretty + xcodebuild build \ + -scheme FDTake \ + -destination "${{ matrix.destination }}" | xcpretty - - name: Build Example App + - name: Test iOS Example App run: | set -o pipefail - xcodebuild -workspace "iOS Example/iOS Example.xcworkspace" \ + xcodebuild build \ + -project "iOS Example/iOS Example.xcodeproj" \ -scheme "iOS Example" \ - -destination "${{ matrix.destination }}" \ - -configuration Debug \ - ONLY_ACTIVE_ARCH=NO \ - build | xcpretty + -destination "${{ matrix.destination }}" | xcpretty - cocoapods: - name: CocoaPods Validation - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - - name: Install CocoaPods - run: gem install cocoapods - - - name: Lint Podspec - run: pod lib lint --allow-warnings - - - name: Check CocoaPods Quality - run: ruby Tests/CheckCocoaPodsQualityIndexes.rb FDTake \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8731732..3881b85 100644 --- a/.gitignore +++ b/.gitignore @@ -41,21 +41,6 @@ playground.xcworkspace .build/ .swiftpm -# CocoaPods -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# Pods/ - -# Carthage -# -# Add this line if you want to avoid checking in source code from Carthage dependencies. -# Carthage/Checkouts - -Carthage/Build - # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the diff --git a/CHANGELOG.md b/CHANGELOG.md index b2b7cad..42e6421 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ All notable changes to this project will be documented in this file. - Updated build environment from Xcode 11.2 to Xcode 15.4 - Updated iOS testing targets from iOS 13.2.2 to iOS 17.5, 16.4, and 14.5 - Updated Swift Package Manager tools version from 5.1 to 5.7 +- **BREAKING:** Removed CocoaPods and Carthage support - use Swift Package Manager instead +- **BREAKING:** Removed Xcode workspace - use the project file directly +- Fixed MobileCoreServices import issue by migrating to UniformTypeIdentifiers framework +- Updated CI to use Xcode project instead of workspace #### KNOWN ISSUES diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6df06b7..412f063 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,19 +9,11 @@ When you commit a change, please add a note to [CHANGELOG.md](CHANGELOG.md). ## Release Process 1. Confirm the build is [passing in GitHub Actions](https://github.com/fulldecent/FDTake/actions) - 1. This automatically checks that the Podfile is building 2. Push a release commit 1. Create a new Master section at the top 2. Rename the old Master section like: ## [1.0.5](https://github.com/fulldecent/FDTake/releases/tag/1.0.5) Released on 2016-02-14. - 3. Update the Podspec version number 3. Create a GitHub release 1. Tag the release (like `1.0.5`) 2. Paste notes from [CHANGELOG.md](CHANGELOG.md) -3. Push the Podspec to CocoaPods - 1. `pod trunk push` -4. Create Carthage binaries - 1. `carthage build --no-skip-current` - 2. `carthage archive FDTake` - 3. Add to the GitHub release diff --git a/FDTake.podspec b/FDTake.podspec deleted file mode 100644 index b187e34..0000000 --- a/FDTake.podspec +++ /dev/null @@ -1,23 +0,0 @@ -Pod::Spec.new do |s| - s.name = "FDTake" - s.version = "3.0.0" - s.summary = "Easily take a photo or video or choose from library" - s.description = <<-DESC - `FDTake` helps you quickly to have the user take or choose an existing photo or video. - DESC - s.homepage = "https://github.com/fulldecent/FDTake" - s.screenshots = "https://i.imgur.com/SpSJzmS.png" - s.license = "MIT" - s.author = { "William Entriken" => "github.com@phor.net" } - s.source = { :git => "https://github.com/fulldecent/FDTake.git", :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/fulldecent' - s.platform = :ios, '12.0' - s.requires_arc = true - s.swift_version = '5.0' - s.source_files = 'Sources/FDTake/**/*.swift' - s.resource_bundles = { - 'Resources' => [ - 'Resources/Resources/*.lproj' - ] -} -end diff --git a/Package.swift b/Package.swift index a6eb146..d8e9669 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let package = Package( name: "FDTake", - platforms: [.iOS(.v12)], + platforms: [.iOS(.v15)], products: [ .library( name: "FDTake", diff --git a/README.md b/README.md index d603277..cf71300 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # FDTake [![CI Status](https://github.com/fulldecent/FDTake/workflows/CI/badge.svg)](https://github.com/fulldecent/FDTake/actions) -[![Version](https://img.shields.io/cocoapods/v/FDTake.svg?style=flat)](http://cocoapods.org/pods/FDTake) -[![License](https://img.shields.io/cocoapods/l/FDTake.svg?style=flat)](http://cocoapods.org/pods/FDTake) -[![Platform](https://img.shields.io/cocoapods/p/FDTake.svg?style=flat)](http://cocoapods.org/pods/FDTake) [![Readme Score](http://readme-score-api.herokuapp.com/score.svg?url=fulldecent/FDTake)](http://clayallsopp.github.io/readme-score?url=fulldecent/FDTake) Easily take a photo or video or choose from library @@ -12,7 +9,7 @@ Easily take a photo or video or choose from library ## Usage -To run the example project, clone the repo, and run `pod install` from the Example directory first. +To run the example project, clone the repo and open `iOS Example/iOS Example.xcodeproj`. To use it in your project, add an `FDTakeController` to your view controller and implement: @@ -112,9 +109,6 @@ open func present() open func dismiss() ``` -Other available options are documented at CocoaDocs for FDTake. - - ## How it works 1. See if device has camera @@ -159,22 +153,7 @@ Other available options are documented at Swift Packages > Add Package Dependency... and you're done. ## Author @@ -184,7 +163,7 @@ William Entriken, github.com@phor.net This is a mature project and we do not expect to add new features unless something has already become state-of-the-art in other applications. Please be prepared to cite screenshots of other apps before making a feature request. -We support targets for the latest released versions of Xcode, Carthage, CocoaPods and Swift Package Manager. If there are incompatabilities, for example CocoaPods not supporting the latest version of Xcode, then we will only support the latest released versions/combinations that are supported. If you would like to support pre-release versions of these packages, please open a pull request, not an issue. +We support targets for the latest released versions of Xcode and Swift Package Manager. If there are incompatibilities, we will only support the latest released versions/combinations that are supported. If you would like to support pre-release versions of these packages, please open a pull request, not an issue. ## License diff --git a/Sources/FDTake/FDTakeController.swift b/Sources/FDTake/FDTakeController.swift index 7017f9c..b1f015d 100644 --- a/Sources/FDTake/FDTakeController.swift +++ b/Sources/FDTake/FDTakeController.swift @@ -6,9 +6,9 @@ // import Foundation -import MobileCoreServices import UIKit import Photos +import UniformTypeIdentifiers /// A class for selecting and taking photos open class FDTakeController: NSObject { @@ -237,10 +237,10 @@ open class FDTakeController: NSObject { self.imagePicker.allowsEditing = self.allowsEditing var mediaTypes = [String]() if self.allowsPhoto { - mediaTypes.append(String(kUTTypeImage)) + mediaTypes.append(UTType.image.identifier) } if self.allowsVideo { - mediaTypes.append(String(kUTTypeMovie)) + mediaTypes.append(UTType.movie.identifier) } self.imagePicker.mediaTypes = mediaTypes @@ -300,8 +300,8 @@ extension FDTakeController : UIImagePickerControllerDelegate, UINavigationContro didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any] ) { UIApplication.shared.isStatusBarHidden = true - switch info[.mediaType] as! CFString { - case kUTTypeImage: + switch info[.mediaType] as! String { + case UTType.image.identifier: let imageToSave: UIImage if let editedImage = info[.editedImage] as? UIImage { imageToSave = editedImage @@ -315,7 +315,7 @@ extension FDTakeController : UIImagePickerControllerDelegate, UINavigationContro if UI_USER_INTERFACE_IDIOM() == .pad { self.imagePicker.dismiss(animated: true) } - case kUTTypeMovie: + case UTType.movie.identifier: self.didGetVideo?(info[.mediaURL] as! URL, info) default: break diff --git a/Tests/CheckCocoaPodsQualityIndexes.rb b/Tests/CheckCocoaPodsQualityIndexes.rb deleted file mode 100644 index f6a9f14..0000000 --- a/Tests/CheckCocoaPodsQualityIndexes.rb +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/ruby - -# -# CheckCocoaPodsQualityIndexes.rb -# by William Entriken, version 1.0.1 -# Part of https://github.com/fulldecent/swift3-module-template -# -# This validates that all controllable quality metrics receive maximum score -# from CocoaPods's scoring quality algorithm -# -# Usage: ruby CheckCocoaPodsQualityIndexes.rb PODNAME -# - -require "json" -require "uri" -require "net/http" - -pod_name = ARGV.shift - -puts "Reviewing CocoaPods's quality metrics for #{pod_name}" -puts "Metrics documentation: https://guides.cocoapods.org/making/quality-indexes.html" -puts "Modifiers from: https://cocoadocs-api-cocoapods-org.herokuapp.com/pods/#{pod_name}/stats" -puts "Raw data from: http://metrics.cocoapods.org/api/v1/pods/#{pod_name}" -puts "NOTE: You must pust a new version to CocoaPods to get new metrics!" -puts "" - -uri = URI.parse('https://cocoadocs-api-cocoapods-org.herokuapp.com/pods/FDTake/stats') -http = Net::HTTP.new(uri.host, uri.port) -http.use_ssl = true if uri.scheme == 'https' -request = Net::HTTP::Get.new uri -response = http.request(request) - -if !response.is_a? Net::HTTPOK - puts "HTTP fetching error!" - exit 1 -end - -passing = true -for metric in JSON.parse(response.body)['metrics'] - if ['Verified Owner', 'Very Popular', 'Popular'].include? metric['title'] - puts "SKIPPED\tYou cannot control: " + metric['title'] - next - end - if metric['modifier'] >= 0 - if metric['applies_for_pod'] - puts "GOOD\tEarned points for: " + metric['title'] - else - puts "BAD\tMissed points for: " + metric['title'] - passing = false - end - else - if metric['applies_for_pod'] - puts "BAD\tLost points for: " + metric['title'] - passing = false - else - puts "GOOD\tAvoided penalty for: " + metric['title'] - end - end -end - -exit passing ? 0 : 1 diff --git a/iOS Example/iOS Example.xcodeproj/project.pbxproj b/iOS Example/iOS Example.xcodeproj/project.pbxproj index 3fcc015..4ccae9d 100644 --- a/iOS Example/iOS Example.xcodeproj/project.pbxproj +++ b/iOS Example/iOS Example.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ @@ -14,6 +14,7 @@ D95E1C471D88E71A00F94976 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D95E1C461D88E71A00F94976 /* ViewController.swift */; }; D95E1C4C1D88E71A00F94976 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D95E1C4B1D88E71A00F94976 /* Assets.xcassets */; }; D95E1C4F1D88E71A00F94976 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D95E1C4D1D88E71A00F94976 /* LaunchScreen.storyboard */; }; + D96829FF2E4D493E0059C071 /* FDTake in Frameworks */ = {isa = PBXBuildFile; productRef = D96829FE2E4D493E0059C071 /* FDTake */; }; D9D7F7BD1D8DAF1900A0DA5B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D9D7F7BC1D8DAF1900A0DA5B /* Main.storyboard */; }; /* End PBXBuildFile section */ @@ -76,6 +77,7 @@ buildActionMask = 2147483647; files = ( C4EEAC1D2385316D00177742 /* FDTake in Frameworks */, + D96829FF2E4D493E0059C071 /* FDTake in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -150,6 +152,7 @@ name = "iOS Example"; packageProductDependencies = ( C4EEAC1C2385316D00177742 /* FDTake */, + D96829FE2E4D493E0059C071 /* FDTake */, ); productName = "iOS Example"; productReference = D95E1C411D88E71A00F94976 /* iOS Example.app */; @@ -161,8 +164,9 @@ D95E1C391D88E71A00F94976 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 0800; - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1640; ORGANIZATIONNAME = "William Entriken"; TargetAttributes = { D95E1C401D88E71A00F94976 = { @@ -199,6 +203,9 @@ "pt-PT", ); mainGroup = D95E1C381D88E71A00F94976; + packageReferences = ( + D96829FD2E4D493E0059C071 /* XCLocalSwiftPackageReference "../../FDTake" */, + ); productRefGroup = D95E1C421D88E71A00F94976 /* Products */; projectDirPath = ""; projectReferences = ( @@ -294,6 +301,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -305,6 +313,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -354,6 +363,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -365,6 +375,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -389,7 +400,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -406,7 +417,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -440,11 +451,22 @@ }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + D96829FD2E4D493E0059C071 /* XCLocalSwiftPackageReference "../../FDTake" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = ../../FDTake; + }; +/* End XCLocalSwiftPackageReference section */ + /* Begin XCSwiftPackageProductDependency section */ C4EEAC1C2385316D00177742 /* FDTake */ = { isa = XCSwiftPackageProductDependency; productName = FDTake; }; + D96829FE2E4D493E0059C071 /* FDTake */ = { + isa = XCSwiftPackageProductDependency; + productName = FDTake; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = D95E1C391D88E71A00F94976 /* Project object */; diff --git a/iOS Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iOS Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata index bfe77a2..919434a 100644 --- a/iOS Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/iOS Example/iOS Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/iOS Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/iOS Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme index 8e145e3..70d3e9b 100644 --- a/iOS Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme +++ b/iOS Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme @@ -1,6 +1,6 @@ - - - - - - diff --git a/iOS Example/iOS Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/iOS Example/iOS Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/iOS Example/iOS Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - -