diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100755 index 0000000..eb957c5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us fix a problem with ColiseuPlayer + +--- + +### Which version of the ColiseuPlayer are you using? +E.g. `1.0.11` + +### On which platform does the issue happen? +E.g. `iOS11` + +### Are you using Carthage? +If yes, specify the version (`carthage version`) + +### Are you using Cocoapods? +If yes, specify the version (`pod --version`) + +### Which version of Xcode are you using? +(`xcodebuild -version`) + +### What did you do? +Describe the problem. +``` +Add a short snippet of code to show the problem +``` + +### What did you expect to happen? +Describe the expected outcome. + +### What happened instead? +Describe what happened instead. diff --git a/.github/ISSUE_TEMPLATE/enhancement_request.md b/.github/ISSUE_TEMPLATE/enhancement_request.md new file mode 100755 index 0000000..d58d6db --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement_request.md @@ -0,0 +1,18 @@ +--- +name: Enhancement request +about: Suggest an enhancement to ColiseuPlayer + +--- + +### Problem description + +A description of a problem, workflow or integration that your suggestion would solve. If the problem is OS-specific, include that information here. + +### Preferred solution + +A description of what changes should be made to ColiseuPlayer to solve the problem. + +### Alternatives + +A description of any alternative solutions or enhancements considered. + diff --git a/.gitignore b/.gitignore index 47042c2..7ba55de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,75 @@ -.DS_Store -xcuserdata + +# Created by https://www.gitignore.io/api/swift,xcode + +### Swift ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xcuserstate +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +# 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/ +*.framework.zip + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output \ No newline at end of file diff --git a/ColiseuPlayer.podspec b/ColiseuPlayer.podspec index 877e822..a19d170 100644 --- a/ColiseuPlayer.podspec +++ b/ColiseuPlayer.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ColiseuPlayer" - s.version = "0.9.1" + s.version = "1.0.0" s.summary = "Audio Player framework" s.homepage = "https://github.com/ricardopereira/ColiseuPlayer" s.license = 'MIT' @@ -10,7 +10,8 @@ Pod::Spec.new do |s| s.platform = :ios, '8.0' s.requires_arc = true + s.swift_version = '5.0' s.source_files = 'ColiseuPlayer/*.{h,swift}' s.frameworks = 'AVFoundation' -end \ No newline at end of file +end diff --git a/ColiseuPlayer.xcodeproj/project.pbxproj b/ColiseuPlayer.xcodeproj/project.pbxproj index fb9cacd..775d667 100644 --- a/ColiseuPlayer.xcodeproj/project.pbxproj +++ b/ColiseuPlayer.xcodeproj/project.pbxproj @@ -306,6 +306,8 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + SHARED_BUILD_NUMBER = 2; + SHARED_VERSION_NUMBER = 1.0.0; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; @@ -356,6 +358,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; + SHARED_BUILD_NUMBER = 2; + SHARED_VERSION_NUMBER = 1.0.0; SWIFT_COMPILATION_MODE = wholemodule; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; diff --git a/ColiseuPlayer.xcodeproj/project.xcworkspace/xcuserdata/ricardopereira.xcuserdatad/UserInterfaceState.xcuserstate b/ColiseuPlayer.xcodeproj/project.xcworkspace/xcuserdata/ricardopereira.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 2760421..0000000 Binary files a/ColiseuPlayer.xcodeproj/project.xcworkspace/xcuserdata/ricardopereira.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/ColiseuPlayer.xcodeproj/xcshareddata/xcschemes/ColiseuPlayer.xcscheme b/ColiseuPlayer.xcodeproj/xcshareddata/xcschemes/ColiseuPlayer.xcscheme index adfbb6b..9b12bc4 100644 --- a/ColiseuPlayer.xcodeproj/xcshareddata/xcschemes/ColiseuPlayer.xcscheme +++ b/ColiseuPlayer.xcodeproj/xcshareddata/xcschemes/ColiseuPlayer.xcscheme @@ -22,7 +22,7 @@ diff --git a/ColiseuPlayer/AudioFile.swift b/ColiseuPlayer/AudioFile.swift index 8cd8759..9296f7e 100644 --- a/ColiseuPlayer/AudioFile.swift +++ b/ColiseuPlayer/AudioFile.swift @@ -2,7 +2,7 @@ // AudioFile.swift // Coliseu // -// Copyright (c) 2014 Ricardo Pereira (http://ricardopereira.eu) +// Copyright (c) 2019 Ricardo Pereira (https://ricardopereira.eu) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/ColiseuPlayer/ColiseuPlayer.h b/ColiseuPlayer/ColiseuPlayer.h index 483d269..b89fff6 100644 --- a/ColiseuPlayer/ColiseuPlayer.h +++ b/ColiseuPlayer/ColiseuPlayer.h @@ -1,6 +1,6 @@ // ColiseuPlayer.h // -// Copyright (c) 2014 Ricardo Pereira (http://ricardopereira.eu) +// Copyright (c) 2019 Ricardo Pereira (https://ricardopereira.eu) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/ColiseuPlayer/ColiseuPlayer.swift b/ColiseuPlayer/ColiseuPlayer.swift index ad351b4..b563028 100644 --- a/ColiseuPlayer/ColiseuPlayer.swift +++ b/ColiseuPlayer/ColiseuPlayer.swift @@ -2,7 +2,7 @@ // ColiseuPlayer.swift // Coliseu // -// Copyright (c) 2014 Ricardo Pereira (http://ricardopereira.eu) +// Copyright (c) 2019 Ricardo Pereira (https://ricardopereira.eu) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/ColiseuPlayer/Info.plist b/ColiseuPlayer/Info.plist index 6010f22..2228279 100644 --- a/ColiseuPlayer/Info.plist +++ b/ColiseuPlayer/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.9 + $(SHARED_VERSION_NUMBER) CFBundleSignature ???? CFBundleVersion - $(CURRENT_PROJECT_VERSION) + $(SHARED_BUILD_NUMBER) NSPrincipalClass diff --git a/ColiseuPlayerTests/Info.plist b/ColiseuPlayerTests/Info.plist index ba72822..796bdc6 100644 --- a/ColiseuPlayerTests/Info.plist +++ b/ColiseuPlayerTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.0 + $(SHARED_VERSION_NUMBER) CFBundleSignature ???? CFBundleVersion - 1 + $(SHARED_BUILD_NUMBER) diff --git a/README.md b/README.md index 2f371bb..f582c32 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,14 @@ -ColiseuPlayer is an audio player framework written in Swift, created for [Coliseu](http://ricardopereira.eu) app. -It uses AVFoundation. +# ColiseuPlayer +[![Build Status](https://app.bitrise.io/app/9e385c486e60951f/status.svg?token=NIFH_3JCupMUSYhpOZWkHA&branch=master)](https://app.bitrise.io/app/9e385c486e60951f) +[![Swift 5](https://img.shields.io/badge/Swift-5-orange.svg?style=flat)](https://developer.apple.com/swift/) +[![Platforms iOS](https://img.shields.io/badge/Platforms-iOS-lightgray.svg?style=flat)](http://www.apple.com/ios/) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) [![Version](https://img.shields.io/cocoapods/v/ColiseuPlayer.svg?style=flat)](http://cocoapods.org/pods/ColiseuPlayer) +[![License MIT](https://img.shields.io/badge/License-MIT-lightgrey.svg?style=flat)](https://opensource.org/licenses/MIT) -## Requirements - -- iOS 8.0+ (not tested on Mac OS X) -- Xcode 7.1+ - -## Installation - -#### [CocoaPods] - -[CocoaPods]: http://cocoapods.org - -To install it, simply add the following line to your Podfile: - -```ruby -pod 'ColiseuPlayer' -``` - -You will also need to make sure you're opting into using frameworks: - -```ruby -use_frameworks! -``` - -Then run `pod install` with CocoaPods 0.36 or newer. - -#### Manually - -ColiseuPlayer in your project requires the following steps:_ - -1. Add ColiseuPlayer as a [submodule](http://git-scm.com/docs/git-submodule) by opening the Terminal, `cd`-ing into your top-level project directory, and entering the command `git submodule add https://github.com/ricardopereira/coliseu.ios.player.git` -2. Open the `ColiseuPlayer` folder, and drag `ColiseuPlayer.xcodeproj` into the file navigator of your app project. -3. In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar. -4. Ensure that the deployment target of ColiseuPlayer.framework matches that of the application target. -5. In the tab bar at the top of that window, open the "Build Phases" panel. -6. Expand the "Link Binary with Libraries" group, and add `ColiseuPlayer.framework`. -7. Click on the `+` button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `ColiseuPlayer.framework`. - ---- +ColiseuPlayer is an audio player framework written in Swift, created for [Coliseu](https://ricardopereira.eu) app. +It uses AVFoundation. ## Usage @@ -91,11 +59,61 @@ class ViewController: UIViewController, ColiseuPlayerDataSource, ColiseuPlayerDe return true } } -```` +``` + +## Requirements -### Contact +- iOS 8.0+ +- Xcode 10.2+ -Follow Coliseu on Twitter ([@coliseuapp](https://twitter.com/coliseuapp)) +## Installation + +#### [Carthage] + +[Carthage]: https://github.com/Carthage/Carthage + +To install it, simply add the following line to your **Cartfile**: + +```ruby +github "ricardopereira/ColiseuPlayer" +``` + +Then run `carthage update`. + +Follow the current instructions in [Carthage's README][carthage-installation] +for up to date installation instructions. + +[carthage-installation]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application + +#### [CocoaPods] + +[CocoaPods]: http://cocoapods.org + +To install it, simply add the following line to your Podfile: + +```ruby +pod 'ColiseuPlayer' +``` + +You will also need to make sure you're opting into using frameworks: + +```ruby +use_frameworks! +``` + +Then run `pod install` with CocoaPods 0.36 or newer. + +#### Manually + +ColiseuPlayer in your project requires the following steps:_ + +1. Add ColiseuPlayer as a [submodule](http://git-scm.com/docs/git-submodule) by opening the Terminal, `cd`-ing into your top-level project directory, and entering the command `git submodule add https://github.com/ricardopereira/coliseu.ios.player.git` +2. Open the `ColiseuPlayer` folder, and drag `ColiseuPlayer.xcodeproj` into the file navigator of your app project. +3. In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar. +4. Ensure that the deployment target of ColiseuPlayer.framework matches that of the application target. +5. In the tab bar at the top of that window, open the "Build Phases" panel. +6. Expand the "Link Binary with Libraries" group, and add `ColiseuPlayer.framework`. +7. Click on the `+` button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `ColiseuPlayer.framework`. ### Author diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..695c47f --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,95 @@ +fastlane_version "2.100.0" +REQUIRED_XCODE_VERSION = "10.2" +default_platform :ios + +PROJECT_NAME = "ColiseuPlayer" + +platform :ios do + desc "Runs all the tests" + lane :test do + scan project: "#{PROJECT_NAME}.xcodeproj" + end + + lane :bump_build_number_with_current_date do |options| + # Set build number to current date and time + build_number = Time.new.strftime("%Y.%-m.%-d.%-H.%-M") + ENV["BUILD_NUMBER"] = build_number + project = Xcodeproj::Project.open("../#{PROJECT_NAME}.xcodeproj") + project.build_configurations.each do |build| + current_build = build.build_settings['SHARED_BUILD_NUMBER'] + puts "#{build.name}: current SHARED_BUILD_NUMBER is #{current_build}" + puts "#{build.name}: setting SHARED_BUILD_NUMBER with #{build_number}" + build.build_settings['SHARED_BUILD_NUMBER'] = build_number + end + puts "Available Targets:" + project.targets.each do |target| + puts " - #{target.name}" + end + project.save() + end + + desc "Bump Version" + lane :bump_version do |options| + version_number = "" + build_number = "" + + project = Xcodeproj::Project.open("../#{PROJECT_NAME}.xcodeproj") + project.build_configurations.each do |build| + # Version Number + current_version = build.build_settings['SHARED_VERSION_NUMBER'] + puts "#{build.name}: current SHARED_VERSION_NUMBER is #{current_version}" + + version_array = current_version.split(".").map(&:to_i) + case options[:bump_type] + when "patch" + version_array[2] = (version_array[2] ? version_array[2] : 0) + 1 + when "minor" + version_array[1] = (version_array[1] ? version_array[1] : 0) + 1 + version_array[2] = version_array[2] = 0 + when "major" + version_array[0] = (version_array[0] ? version_array[0] : 0) + 1 + version_array[1] = version_array[1] = 0 + version_array[1] = version_array[2] = 0 + end + + if options[:omit_zero_patch_version] && version_array[2] == 0 + version_array.pop() + end + + version_number = version_array.join(".") + puts "#{build.name}: setting new SHARED_VERSION_NUMBER with #{version_number}" + build.build_settings['SHARED_VERSION_NUMBER'] = version_number + ENV["SHARED_VERSION_NUMBER"] = version_number + + # Build Number + current_build = build.build_settings['SHARED_BUILD_NUMBER'] + puts "#{build.name}: current SHARED_BUILD_NUMBER is #{current_build}" + build_number = current_build.to_i + 1 + puts "#{build.name}: setting new SHARED_BUILD_NUMBER with #{build_number}" + build.build_settings['SHARED_BUILD_NUMBER'] = build_number.to_s + ENV["SHARED_BUILD_NUMBER"] = build_number.to_s + end + puts "Available Targets:" + project.targets.each do |target| + puts " - #{target.name}" + end + project.save() + + puts "Bump to v#{version_number} (#{build_number})" + end + + desc "Prepare a new Release version" + lane :release do |options| + ensure_git_status_clean(show_uncommitted_changes: true) + + bump_version bump_type: options[:bump] + version_bump_podspec bump_type: options[:bump] + + clean_build_artifacts + + git_commit(path: [ + "./#{PROJECT_NAME}.xcodeproj/project.pbxproj", + "./#{PROJECT_NAME}.podspec", + ], message: "Bump to v" + ENV["SHARED_VERSION_NUMBER"]) + end +end \ No newline at end of file diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000..b178bb1 --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,44 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew cask install fastlane` + +# Available Actions +## iOS +### ios test +``` +fastlane ios test +``` +Runs all the tests +### ios bump_build_number_with_current_date +``` +fastlane ios bump_build_number_with_current_date +``` + +### ios bump_version +``` +fastlane ios bump_version +``` +Bump Version +### ios release +``` +fastlane ios release +``` +Prepare a new Release version + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).