├── Cartfile ├── Cartfile.resolved ├── art ├── detail.png ├── player.png └── podcasts.png ├── Podcasts ├── Assets │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── logos │ │ │ ├── Contents.json │ │ │ ├── logo-dark.imageset │ │ │ │ ├── api-dark background for non-white background.png │ │ │ │ └── Contents.json │ │ │ └── logo.imageset │ │ │ │ ├── api-transparent background for non-white background.png │ │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ └── Base.lproj │ │ └── LaunchScreen.storyboard ├── Preview Content │ ├── Preview Assets.xcassets │ │ └── Contents.json │ └── Previews.swift ├── Core │ ├── Podcasts │ │ ├── Constants.swift │ │ ├── Models │ │ │ ├── Episode.swift │ │ │ └── Podcast.swift │ │ └── PodcastRepository.swift │ ├── AnySubscription.swift │ └── Player │ │ └── Player.swift ├── Shared │ ├── Int+Timestamp.swift │ ├── AppDelegate+Container.swift │ ├── Date+Formatter.swift │ ├── Container.swift │ ├── UIImage+Color.swift │ ├── ImagesLoader.swift │ └── ImageLoader.swift ├── shared │ └── UIImage+Color.swift ├── Scenes │ ├── Views │ │ ├── Spinner.swift │ │ └── ProgressView.swift │ ├── Episode │ │ └── EpisodeView.swift │ ├── Podcast │ │ ├── EpisodeRow.swift │ │ ├── PodcastViewModel.swift │ │ ├── PodcastHeaderView.swift │ │ └── PodcastView.swift │ ├── HomeView.swift │ ├── Podcasts │ │ ├── PodcastsViewModel.swift │ │ ├── PodcastRow.swift │ │ └── PodcastsView.swift │ └── Player │ │ └── PlayerView.swift ├── AppDelegate.swift ├── Info.plist └── SceneDelegate.swift ├── Podcasts.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── alberto.penas.amor.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── README.md ├── PodcastsTests ├── Info.plist └── PodcastsTests.swift ├── LICENSE └── .gitignore /Cartfile: -------------------------------------------------------------------------------- 1 | github "onevcat/Kingfisher" ~> 5.0 2 | 3 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "onevcat/Kingfisher" "5.6.0" 2 | -------------------------------------------------------------------------------- /art/detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertopeam/Podcasts/HEAD/art/detail.png -------------------------------------------------------------------------------- /art/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertopeam/Podcasts/HEAD/art/player.png -------------------------------------------------------------------------------- /art/podcasts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertopeam/Podcasts/HEAD/art/podcasts.png -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/logos/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Podcasts/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Podcasts.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/logos/logo-dark.imageset/api-dark background for non-white background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertopeam/Podcasts/HEAD/Podcasts/Assets/Assets.xcassets/logos/logo-dark.imageset/api-dark background for non-white background.png -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/logos/logo.imageset/api-transparent background for non-white background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/albertopeam/Podcasts/HEAD/Podcasts/Assets/Assets.xcassets/logos/logo.imageset/api-transparent background for non-white background.png -------------------------------------------------------------------------------- /Podcasts/Core/Podcasts/Constants.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 18/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum Constants { 12 | static var apiKey = "" 13 | } 14 | -------------------------------------------------------------------------------- /Podcasts.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Podcasts/Shared/Int+Timestamp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TimeInterval+MS.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 11/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Int { 12 | 13 | var intervalFromMiliseconds: TimeInterval { 14 | return TimeInterval(self / 1000) 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Podcasts/Shared/AppDelegate+Container.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+Container.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 17/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit.UIApplication 10 | 11 | extension AppDelegate { 12 | static var container: Container { 13 | let delegate = UIApplication.shared.delegate as! AppDelegate 14 | return delegate.appContainer 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Podcasts/Shared/Date+Formatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Date+Formatter.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 11/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Date { 12 | 13 | var formatMedium: String { 14 | let formatter = DateFormatter() 15 | formatter.dateStyle = .medium 16 | return formatter.string(from: self) 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Podcasts.xcodeproj/xcuserdata/alberto.penas.amor.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Podcasts.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/logos/logo-dark.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "api-dark background for non-white background.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/logos/logo.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "api-transparent background for non-white background.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Podcasts/Shared/Container.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Container.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 17/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Container { 12 | private let player: Player = Player() 13 | } 14 | 15 | extension Container { 16 | private static var instance: Container { 17 | return AppDelegate.container 18 | } 19 | static var player: Player { 20 | return Container.instance.player 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Podcasts/Core/Podcasts/Models/Episode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Episode.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 09/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Episode: Equatable { 12 | let id: String 13 | let title: String 14 | let description: String 15 | let pubDate: Date 16 | let audio: URL? 17 | let audioLenght: Int 18 | let image: URL? 19 | let thumbnail: URL? 20 | let maybeAudioInvalid: Bool 21 | let explicitContent: Bool 22 | } 23 | -------------------------------------------------------------------------------- /Podcasts/Core/AnySubscription.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnySubscription.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | 12 | final class AnySubscription: Subscription { 13 | private let cancellable: Cancellable 14 | 15 | init(_ cancel: @escaping () -> Void) { 16 | cancellable = AnyCancellable(cancel) 17 | } 18 | 19 | func request(_ demand: Subscribers.Demand) {} 20 | 21 | func cancel() { 22 | cancellable.cancel() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Podcasts/Core/Podcasts/Models/Podcast.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Podcasts.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct Podcast: Equatable { 12 | let id: String 13 | let title: String 14 | let image: URL? 15 | let thumbnail: URL? 16 | let totalEpisodes: Int 17 | let explicitContent: Bool 18 | let description: String 19 | let language: String 20 | let country: String 21 | let rss: URL? 22 | let latestPubDateMs: Date 23 | let earliestPubDateMs: Date 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Podcasts 2 | Simple app to show usage of SwiftUI and Combine. The app shows a list of podcasts fetched from [listennotes](https://www.listennotes.com/api/) and it can be played. 3 | 4 |
5 | podcasts 6 | detail 7 | player 8 |
9 | 10 | Status: Work in progress. 11 | 12 | TODO'S: 13 | 14 | * Wrap Image Loader to avoid reload the entire view 15 | * Migrate all the views to have enum states 16 | * Try environment object 17 | * Check cancelations 18 | 19 | Warning: SwiftUI and Combine are in beta now. 20 | -------------------------------------------------------------------------------- /Podcasts/Shared/UIImage+Color.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Color.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 10/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit.UIImage 10 | 11 | extension UIImage { 12 | static func from(color: UIColor) -> UIImage { 13 | let rect = CGRect(x: 0, y: 0, width: 1, height: 1) 14 | UIGraphicsBeginImageContext(rect.size) 15 | let context = UIGraphicsGetCurrentContext() 16 | context!.setFillColor(color.cgColor) 17 | context!.fill(rect) 18 | let img = UIGraphicsGetImageFromCurrentImageContext() 19 | UIGraphicsEndImageContext() 20 | return img! 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Podcasts/shared/UIImage+Color.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+Color.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 10/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit.UIImage 10 | 11 | extension UIImage { 12 | static func from(color: UIColor) -> UIImage { 13 | let rect = CGRect(x: 0, y: 0, width: 1, height: 1) 14 | UIGraphicsBeginImageContext(rect.size) 15 | let context = UIGraphicsGetCurrentContext() 16 | context!.setFillColor(color.cgColor) 17 | context!.fill(rect) 18 | let img = UIGraphicsGetImageFromCurrentImageContext() 19 | UIGraphicsEndImageContext() 20 | return img! 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Views/Spinner.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Spinner.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 11/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct Spinner : View { 12 | 13 | let items: Int = 3 14 | 15 | var body: some View { 16 | HStack { 17 | ForEach(0.. 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Podcasts/Scenes/HomeView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 08/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct HomeView : View { 12 | 13 | @State private var selected = 0 14 | 15 | var body: some View { 16 | TabbedView(selection: $selected) { 17 | PodcastsView() 18 | .tabItemLabel(Text("Podcasts")) 19 | .tag(0) 20 | // Text("...") 21 | // .font(.title) 22 | // .tabItemLabel(Text("Search")) 23 | // .tag(1) 24 | } 25 | } 26 | } 27 | 28 | #if DEBUG 29 | struct HomeView_Previews : PreviewProvider { 30 | static var previews: some View { 31 | HomeView() 32 | } 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Views/ProgressView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ProgressView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 18/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | final class ProgressView: UIViewRepresentable { 12 | 13 | typealias UIViewType = UIProgressView 14 | private let progress: Float 15 | 16 | init(progress: Float = 0) { 17 | self.progress = progress 18 | } 19 | 20 | func makeUIView(context: UIViewRepresentableContext) -> UIProgressView { 21 | let progressView = UIProgressView.init(frame: CGRect.zero) 22 | progressView.progress = progress 23 | return progressView 24 | } 25 | 26 | func updateUIView(_ uiView: UIProgressView, context: UIViewRepresentableContext) { 27 | uiView.setProgress(progress, animated: true) 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /PodcastsTests/PodcastsTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastsTests.swift 3 | // PodcastsTests 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import Podcasts 11 | 12 | class PodcastsTests: XCTestCase { 13 | 14 | // private var sut: Podcasts! 15 | // private var publisher: PodcastPublisher! 16 | // 17 | // override func setUp() { 18 | // super.setUp() 19 | // sut = Podcasts() 20 | // } 21 | // 22 | // override func tearDown() { 23 | // sut = nil 24 | // super.tearDown() 25 | // } 26 | // 27 | // func test_() { 28 | // let exp = XCTestExpectation() 29 | // publisher = PodcastPublisher() 30 | // publisher.passhtrough.assign??? 31 | // publisher.passhtrough.receive(subscriber: self).sink { (podcasts) in 32 | // exp.fulfill() 33 | // } 34 | // wait(for: [exp], timeout: 10) 35 | // } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Alberto Penas Amor 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcasts/PodcastsViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Podcasts.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import SwiftUI 11 | import Combine 12 | 13 | class PodcastsViewModel: BindableObject { 14 | 15 | var didChange = PassthroughSubject() 16 | private let podcastRepository: PodcastRepository 17 | private var podcastsCancelable: Cancellable? 18 | private var page: Int 19 | //TODO: enum state 20 | private(set) var podcasts = [Podcast]() { didSet { didChange.send(self) } } 21 | 22 | init(podcastRepository: PodcastRepository = PodcastRepository(), 23 | page: Int = 0) { 24 | self.podcastRepository = podcastRepository 25 | self.page = page 26 | } 27 | 28 | deinit { 29 | podcastsCancelable?.cancel() 30 | } 31 | 32 | func bestPodcasts() { 33 | podcastsCancelable = podcastRepository 34 | .bestPodcasts(page: page) 35 | .replaceError(with: []) 36 | .receive(on: RunLoop.main) 37 | .sink(receiveValue: { self.podcasts.append(contentsOf: $0) }) 38 | page += 1 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcast/PodcastViewModel.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastViewModel.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 09/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | import SwiftUI 12 | 13 | class PodcastViewModel: BindableObject { 14 | 15 | var didChange = PassthroughSubject() 16 | private let podcastRepository: PodcastRepository 17 | private var episodesCancelable: Cancellable? 18 | private(set) var podcast: Podcast { 19 | didSet { didChange.send(self) } 20 | } 21 | private(set) var episodes = [Episode]() { 22 | didSet { didChange.send(self) } 23 | } 24 | 25 | init(podcast: Podcast, 26 | podcastRepository: PodcastRepository = PodcastRepository()) { 27 | self.podcast = podcast 28 | self.podcastRepository = podcastRepository 29 | } 30 | 31 | deinit { 32 | episodesCancelable?.cancel() 33 | } 34 | 35 | func loadEpisodes() { 36 | episodesCancelable = podcastRepository.episodes(for: podcast) 37 | .receive(on: RunLoop.main) 38 | .replaceError(with: []) 39 | .assign(to: \.episodes, on: self) 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcasts/PodcastRow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastRow.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 08/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct PodcastRow : View { 12 | 13 | @ObjectBinding var imageLoader: ImageLoader 14 | let podcast: Podcast 15 | 16 | init(imageLoader: ImageLoader = ImageLoader(), 17 | podcast: Podcast) { 18 | self.imageLoader = imageLoader 19 | self.podcast = podcast 20 | } 21 | 22 | var body: some View { 23 | HStack { 24 | Image(uiImage: self.imageLoader.image(for: self.podcast.thumbnail)) 25 | .frame(width: 64, height: 64, alignment: .center) 26 | .aspectRatio(contentMode: ContentMode.fit) 27 | .clipShape(Circle()) 28 | VStack(alignment: .leading) { 29 | Text(podcast.title) 30 | .lineLimit(nil) 31 | .font(.headline) 32 | Text(podcast.language) 33 | .lineLimit(1) 34 | .font(.caption) 35 | } 36 | } 37 | } 38 | } 39 | 40 | #if DEBUG 41 | struct PodcastRow_Previews : PreviewProvider { 42 | static var previews: some View { 43 | PodcastRow(podcast: podcasts.first!) 44 | } 45 | } 46 | #endif 47 | -------------------------------------------------------------------------------- /Podcasts/Shared/ImagesLoader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KingfisherWrapper.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 10/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit.UIImage 10 | import SwiftUI 11 | import Combine 12 | import class Kingfisher.ImageDownloader 13 | 14 | //TODO: not loading images from cache, check the another cache... 15 | class ImagesLoader: BindableObject { 16 | 17 | var didChange = PassthroughSubject() 18 | private(set) var images = [URL: UIImage]() { 19 | didSet { 20 | didChange.send(self) 21 | } 22 | } 23 | private let downloader: ImageDownloader 24 | 25 | init(downloader: ImageDownloader = ImageDownloader.default) { 26 | self.downloader = downloader 27 | } 28 | 29 | func load(url: URL?) { 30 | guard let url = url else { 31 | return 32 | } 33 | downloader.downloadImage(with: url, options: nil, progressBlock: nil) { (result) in 34 | switch result { 35 | case .success(let image): 36 | self.images[url] = image.image 37 | case .failure(_): 38 | break 39 | } 40 | } 41 | } 42 | 43 | func image(for url: URL?) -> UIImage { 44 | guard let url = url else { 45 | return UIImage.from(color: .gray) 46 | } 47 | guard let image = images[url] else { 48 | return UIImage.from(color: .gray) 49 | } 50 | return image 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcasts/PodcastsView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct PodcastsView : View { 12 | 13 | @ObjectBinding var podcastViewModel: PodcastsViewModel 14 | 15 | init(podcastViewModel: PodcastsViewModel = PodcastsViewModel()) { 16 | self.podcastViewModel = podcastViewModel 17 | } 18 | 19 | var body: some View { 20 | NavigationView() { 21 | if podcastViewModel.podcasts.isEmpty { 22 | Spinner().navigationBarTitle(Text("Best Podcasts"), displayMode: NavigationBarItem.TitleDisplayMode.inline) 23 | } else { 24 | List { 25 | ForEach(podcastViewModel.podcasts.identified(by: \.id)) { podcast in 26 | NavigationButton(destination: PodcastView(podcast: podcast), label: { 27 | PodcastRow(podcast: podcast) 28 | }) 29 | } 30 | Rectangle().frame(height: 0).onAppear { 31 | self.podcastViewModel.bestPodcasts() 32 | } 33 | }.navigationBarTitle(Text("Best Podcasts"), displayMode: NavigationBarItem.TitleDisplayMode.inline) 34 | PlayerView() 35 | } 36 | }.onAppear(perform: { 37 | self.podcastViewModel.bestPodcasts() 38 | }) 39 | } 40 | 41 | } 42 | 43 | #if DEBUG 44 | struct ContentView_Previews : PreviewProvider { 45 | static var previews: some View { 46 | PodcastsView() 47 | } 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | Carthage/Checkouts 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots/**/*.png 67 | fastlane/test_output 68 | -------------------------------------------------------------------------------- /Podcasts/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | let appContainer: Container = Container() 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillTerminate(_ application: UIApplication) { 22 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 23 | } 24 | 25 | // MARK: UISceneSession Lifecycle 26 | 27 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 28 | // Called when a new scene session is being created. 29 | // Use this method to select a configuration to create the new scene with. 30 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 31 | } 32 | 33 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 34 | // Called when the user discards a scene session. 35 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 36 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcast/PodcastHeaderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastHeaderView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 10/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | 11 | struct PodcastHeaderView : View { 12 | 13 | let podcast: Podcast 14 | let imageLoader: ImageLoader 15 | 16 | init(podcast: Podcast, 17 | imageLoader: ImageLoader) { 18 | self.podcast = podcast 19 | self.imageLoader = imageLoader 20 | } 21 | 22 | var body: some View { 23 | HStack { 24 | VStack { 25 | Image(uiImage: imageLoader.image(for: podcast.thumbnail)) 26 | .frame(width: 128, height: 128) 27 | .aspectRatio(contentMode: ContentMode.fit) 28 | .clipShape(Circle()) 29 | .overlay(Circle().stroke(Color.white, lineWidth: 2)) 30 | .shadow(radius: 4) 31 | Text(podcast.language) 32 | .frame(alignment: .trailing) 33 | .lineLimit(1) 34 | .font(.caption) 35 | .foregroundColor(Color.red) 36 | } 37 | Spacer().frame(maxWidth: 20) 38 | VStack(alignment: .leading) { 39 | Text(podcast.title) 40 | .lineLimit(nil) 41 | .font(.headline) 42 | Spacer().frame(maxHeight: 10) 43 | Text(podcast.description) 44 | .lineLimit(nil) 45 | .font(.caption) 46 | } 47 | } 48 | .padding([.top]) 49 | } 50 | 51 | } 52 | 53 | #if DEBUG 54 | struct PodcastHeaderView_Previews : PreviewProvider { 55 | static var previews: some View { 56 | PodcastHeaderView(podcast: podcasts.first!, imageLoader: ImageLoader()) 57 | } 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /Podcasts/Assets/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Podcasts/Scenes/Podcast/PodcastView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 08/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | //TODO: como gestionar esta inyeccion: `PodcastViewModel` ????, con un var tal vez???? 10 | import SwiftUI 11 | 12 | struct PodcastView : View { 13 | 14 | @ObjectBinding var podcastViewModel: PodcastViewModel 15 | @ObjectBinding var imageLoader: ImageLoader 16 | @ObjectBinding var player: Player 17 | 18 | init(podcast: Podcast, 19 | imageLoader: ImageLoader = ImageLoader(), 20 | player: Player = Container.player) { 21 | self.podcastViewModel = PodcastViewModel(podcast: podcast) 22 | self.imageLoader = imageLoader 23 | self.player = player 24 | } 25 | 26 | var body: some View { 27 | VStack { 28 | List { 29 | PodcastHeaderView(podcast: podcastViewModel.podcast, imageLoader: imageLoader) 30 | if podcastViewModel.episodes.isEmpty { 31 | Spinner() 32 | } else { 33 | HStack { 34 | Spacer() 35 | Button(action: { 36 | self.player.setup(for: self.podcastViewModel.episodes) 37 | }, label: { 38 | Text("Prepare to play") 39 | }).foregroundColor(.green) 40 | Spacer() 41 | } 42 | ForEach(podcastViewModel.episodes.identified(by: \.id)) { episode in 43 | NavigationButton(destination: EpisodeView(episode: episode)) { 44 | EpisodeRow(episode: episode) 45 | } 46 | } 47 | } 48 | } 49 | PlayerView() 50 | }.navigationBarTitle(Text(podcastViewModel.podcast.title)) 51 | .onAppear(perform: { 52 | self.podcastViewModel.loadEpisodes() 53 | }) 54 | } 55 | } 56 | 57 | #if DEBUG 58 | struct PodcastView_Previews : PreviewProvider { 59 | static var previews: some View { 60 | PodcastView(podcast: podcasts.first!) 61 | } 62 | } 63 | #endif 64 | -------------------------------------------------------------------------------- /Podcasts/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UILaunchStoryboardName 33 | LaunchScreen 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | 39 | 40 | 41 | 42 | UIBackgroundModes 43 | 44 | audio 45 | bluetooth-central 46 | 47 | UILaunchStoryboardName 48 | LaunchScreen 49 | UIRequiredDeviceCapabilities 50 | 51 | armv7 52 | 53 | UISupportedInterfaceOrientations 54 | 55 | UIInterfaceOrientationPortrait 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | UISupportedInterfaceOrientations~ipad 60 | 61 | UIInterfaceOrientationPortrait 62 | UIInterfaceOrientationPortraitUpsideDown 63 | UIInterfaceOrientationLandscapeLeft 64 | UIInterfaceOrientationLandscapeRight 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Podcasts/Scenes/Player/PlayerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerView.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 11/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import SwiftUI 10 | import Combine 11 | 12 | struct PlayerView : View { 13 | 14 | @ObjectBinding var player: Player 15 | 16 | init(player: Player = Container.player) { 17 | self.player = player 18 | } 19 | 20 | var body: some View { 21 | return VStack { 22 | if player.hasEpisodes { 23 | ProgressView(progress: player.progress) 24 | HStack { 25 | Button(action: { 26 | self.player.previous() 27 | }) { 28 | return Image(systemName: "backward.end") 29 | }.imageScale(.large) 30 | Button(action: { 31 | switch self.player.state { 32 | case .empty, .finish: 33 | break 34 | case .idle: 35 | self.player.play() 36 | case .playing: 37 | self.player.pause() 38 | case .paused: 39 | self.player.play() 40 | } 41 | }) { () -> Image in 42 | switch self.player.state { 43 | case .empty, .paused, .idle: 44 | return Image(systemName: "play") 45 | case .playing: 46 | return Image(systemName: "pause") 47 | case .finish: 48 | return Image(systemName: "pause") 49 | } 50 | }.imageScale(.large) 51 | Button(action: { 52 | self.player.next() 53 | }) { 54 | return Image(systemName: "forward.end") 55 | }.imageScale(.large) 56 | Text(player.current?.title) 57 | Spacer() 58 | }.padding() 59 | } 60 | } 61 | } 62 | 63 | } 64 | 65 | extension Text { 66 | init(_ string: String?) { 67 | self.init(verbatim: string ?? "") 68 | } 69 | } 70 | #if DEBUG 71 | struct PlayerView_Previews : PreviewProvider { 72 | static var previews: some View { 73 | PlayerView() 74 | } 75 | } 76 | #endif 77 | -------------------------------------------------------------------------------- /Podcasts/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SwiftUI 11 | 12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 21 | 22 | // Use a UIHostingController as window root view controller 23 | let window = UIWindow(frame: UIScreen.main.bounds) 24 | window.rootViewController = UIHostingController(rootView: HomeView().environmentObject(Player())) 25 | self.window = window 26 | window.makeKeyAndVisible() 27 | } 28 | 29 | func sceneDidDisconnect(_ scene: UIScene) { 30 | // Called as the scene is being released by the system. 31 | // This occurs shortly after the scene enters the background, or when its session is discarded. 32 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 33 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 34 | } 35 | 36 | func sceneDidBecomeActive(_ scene: UIScene) { 37 | // Called when the scene has moved from an inactive state to an active state. 38 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 39 | } 40 | 41 | func sceneWillResignActive(_ scene: UIScene) { 42 | // Called when the scene will move from an active state to an inactive state. 43 | // This may occur due to temporary interruptions (ex. an incoming phone call). 44 | } 45 | 46 | func sceneWillEnterForeground(_ scene: UIScene) { 47 | // Called as the scene transitions from the background to the foreground. 48 | // Use this method to undo the changes made on entering the background. 49 | } 50 | 51 | func sceneDidEnterBackground(_ scene: UIScene) { 52 | // Called as the scene transitions from the foreground to the background. 53 | // Use this method to save data, release shared resources, and store enough scene-specific state information 54 | // to restore the scene back to its current state. 55 | } 56 | 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Podcasts/Shared/ImageLoader.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ImageLoader.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 10/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import UIKit.UIImage 10 | import SwiftUI 11 | import Combine 12 | import class Kingfisher.ImageDownloader 13 | import struct Kingfisher.DownloadTask 14 | import class Kingfisher.ImageCache 15 | import class Kingfisher.KingfisherManager 16 | 17 | class ImageLoader: BindableObject { 18 | 19 | var didChange = PassthroughSubject() 20 | private let downloader: ImageDownloader 21 | private let cache: ImageCache 22 | private var image: UIImage? { 23 | didSet { 24 | dispatchqueue.async { [weak self] in 25 | guard let self = self else { return } 26 | self.didChange.send(self) 27 | } 28 | } 29 | } 30 | private var task: DownloadTask? 31 | private let dispatchqueue: DispatchQueue 32 | 33 | init(downloader: ImageDownloader = KingfisherManager.shared.downloader, 34 | cache: ImageCache = KingfisherManager.shared.cache, 35 | dispatchqueue: DispatchQueue = DispatchQueue.main) { 36 | self.downloader = downloader 37 | self.cache = cache 38 | self.dispatchqueue = dispatchqueue 39 | } 40 | 41 | deinit { 42 | task?.cancel() 43 | } 44 | 45 | func image(for url: URL?) -> UIImage { 46 | guard let targetUrl = url else { 47 | return UIImage.from(color: .gray) 48 | } 49 | guard let image = image else { 50 | load(url: targetUrl) 51 | return UIImage.from(color: .gray) 52 | } 53 | return image 54 | } 55 | 56 | private func load(url: URL) { 57 | let key = url.absoluteString 58 | if cache.isCached(forKey: key) { 59 | cache.retrieveImage(forKey: key) { [weak self] (result) in 60 | guard let self = self else { return } 61 | switch result { 62 | case .success(let value): 63 | self.image = value.image 64 | case .failure(let error): 65 | print(error.localizedDescription) 66 | } 67 | } 68 | } else { 69 | downloader.downloadImage(with: url, options: nil, progressBlock: nil) { [weak self] (result) in 70 | guard let self = self else { return } 71 | switch result { 72 | case .success(let value): 73 | self.cache.storeToDisk(value.originalData, forKey: url.absoluteString) 74 | self.image = value.image 75 | case .failure(let error): 76 | print(error.localizedDescription) 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Podcasts/Assets/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Podcasts/Core/Podcasts/PodcastRepository.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PodcastRepository.swift 3 | // Podcasts 4 | // 5 | // Created by Alberto on 07/06/2019. 6 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Combine 11 | import SwiftUI 12 | 13 | class PodcastRepository { 14 | 15 | private let apiKey: String 16 | private let endpoint: String = "https://listen-api.listennotes.com" 17 | private let urlSession: URLSession 18 | 19 | init(apiKey: String = Constants.apiKey, urlSession: URLSession = URLSession.shared) { 20 | self.apiKey = apiKey 21 | self.urlSession = urlSession 22 | } 23 | 24 | private var components: URLComponents { 25 | return URLComponents(string: endpoint)! 26 | } 27 | 28 | private var decoder: JSONDecoder { 29 | let decoder = JSONDecoder() 30 | decoder.keyDecodingStrategy = .convertFromSnakeCase 31 | return decoder 32 | } 33 | 34 | func bestPodcasts(page: Int) -> AnyPublisher<[Podcast], Error> { 35 | var urlComponents = components 36 | urlComponents.path = "/api/v2/best_podcasts" 37 | urlComponents.queryItems = [URLQueryItem(name: "page", value: "\(page)"), 38 | URLQueryItem(name: "region", value: "us"), 39 | URLQueryItem(name: "safe_mode", value: "0")] 40 | var request = URLRequest(url: urlComponents.url!) 41 | request.addValue("application/json", forHTTPHeaderField: "Content-Type") 42 | request.addValue(apiKey, forHTTPHeaderField: "X-ListenAPI-Key") 43 | return urlSession.dataTaskPublisher(for: request) 44 | .map({ (data, response) -> Data in return data }) 45 | .decode(type: CodableBestPodcasts.self, decoder: decoder) 46 | .map { $0.podcasts } 47 | .map({ $0.map({ Podcast(id: $0.id, 48 | title: $0.title, 49 | image: URL(string: $0.image), 50 | thumbnail: URL(string: $0.thumbnail), 51 | totalEpisodes: $0.totalEpisodes, 52 | explicitContent: $0.explicitContent, 53 | description: $0.description, 54 | language: $0.language, 55 | country: $0.country, 56 | rss: URL(string: $0.rss), 57 | latestPubDateMs: Date(timeIntervalSince1970: $0.latestPubDateMs.intervalFromMiliseconds), 58 | earliestPubDateMs: Date(timeIntervalSince1970: $0.earliestPubDateMs.intervalFromMiliseconds))}) }) 59 | .print() 60 | .share() 61 | .eraseToAnyPublisher() 62 | } 63 | 64 | func episodes(for podcast: Podcast) -> AnyPublisher<[Episode] ,Error> { 65 | var urlComponents = components 66 | urlComponents.path = "/api/v2/podcasts/\(podcast.id)" 67 | urlComponents.queryItems = [URLQueryItem(name: "sort", value: "recent_first")] 68 | var request = URLRequest(url: urlComponents.url!) 69 | request.addValue("application/json", forHTTPHeaderField: "Content-Type") 70 | request.addValue(apiKey, forHTTPHeaderField: "X-ListenAPI-Key") 71 | return urlSession.dataTaskPublisher(for: request) 72 | .map({ (data, response) -> Data in return data }) 73 | .decode(type: CodableEpisodes.self, decoder: decoder) 74 | .map { $0.episodes } 75 | .map({ $0.map({ Episode(id: $0.id, 76 | title: $0.title, 77 | description: $0.description, 78 | pubDate: Date(timeIntervalSince1970: $0.pubDateMs.intervalFromMiliseconds), 79 | audio: URL(string: $0.audio), 80 | audioLenght: $0.audioLengthSec, 81 | image: URL(string: $0.image), 82 | thumbnail: URL(string: $0.thumbnail), 83 | maybeAudioInvalid: $0.maybeAudioInvalid, 84 | explicitContent: $0.explicitContent)}) }) 85 | .print() 86 | .share() 87 | .eraseToAnyPublisher() 88 | } 89 | 90 | } 91 | 92 | private struct CodableBestPodcasts: Codable { 93 | let podcasts: [CodablePodcast] 94 | } 95 | 96 | private struct CodablePodcast: Codable { 97 | let id: String 98 | let title: String 99 | let image: String 100 | let thumbnail: String 101 | let totalEpisodes: Int 102 | let explicitContent: Bool 103 | let description: String 104 | let language: String 105 | let country: String 106 | let rss: String 107 | let latestPubDateMs: Int 108 | let earliestPubDateMs: Int 109 | } 110 | 111 | private struct CodableEpisodes: Codable { 112 | let episodes: [CodableEpisode] 113 | let nextEpisodePubDate: Int 114 | } 115 | 116 | private struct CodableEpisode: Codable { 117 | let id: String 118 | let title: String 119 | let description: String 120 | let pubDateMs: Int 121 | let audio: String 122 | let audioLengthSec: Int 123 | let image: String 124 | let thumbnail: String 125 | let maybeAudioInvalid: Bool 126 | let explicitContent: Bool 127 | } 128 | 129 | -------------------------------------------------------------------------------- /Podcasts/Core/Player/Player.swift: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Player.swift 4 | // Podcasts 5 | // 6 | // Created by Alberto on 11/06/2019. 7 | // Copyright © 2019 com.github.albertopeam. All rights reserved. 8 | // 9 | 10 | import Foundation 11 | import MediaPlayer 12 | import Combine 13 | import SwiftUI 14 | 15 | class Player: BindableObject { 16 | 17 | enum State { 18 | case empty 19 | case idle(episodes: [Episode]) 20 | case playing(episode: Episode, progress: Float) 21 | case paused(episode: Episode, progress: Float) 22 | case finish(episodes: [Episode]) 23 | } 24 | 25 | var didChange: CurrentValueSubject = CurrentValueSubject(.empty) 26 | var state: State = .empty { 27 | didSet { 28 | didChange.send(state) 29 | } 30 | } 31 | var current: Episode? 32 | private var episodes: [Episode] = [] 33 | private let avPlayer: AVPlayer 34 | private let notificationCenter: NotificationCenter 35 | private let systemPlayer: MPNowPlayingInfoCenter 36 | 37 | init(avPlayer: AVPlayer = AVPlayer(), 38 | avSession: AVAudioSession = AVAudioSession.sharedInstance(), 39 | notificationCenter: NotificationCenter = .default, 40 | systemPlayer: MPNowPlayingInfoCenter = MPNowPlayingInfoCenter.default()) { 41 | self.avPlayer = avPlayer 42 | self.notificationCenter = notificationCenter 43 | self.systemPlayer = systemPlayer 44 | self.notificationCenter.addObserver(self, selector: #selector(self.didPlayToEnd), name: .AVPlayerItemDidPlayToEndTime, object: nil) 45 | let interval = CMTime(seconds: 1, preferredTimescale: CMTimeScale(NSEC_PER_SEC)) 46 | self.avPlayer.addPeriodicTimeObserver(forInterval: interval, queue: DispatchQueue.main, using: didUpdatedPlayer) 47 | try? avSession.setCategory(AVAudioSession.Category.playback, 48 | mode: AVAudioSession.Mode.default, 49 | options: [.allowBluetooth, .allowAirPlay, .defaultToSpeaker]) 50 | } 51 | 52 | deinit { 53 | notificationCenter.removeObserver(self) 54 | avPlayer.removeTimeObserver(self) 55 | } 56 | 57 | // MARK: Player 58 | 59 | func setup(for episodes: [Episode]) { 60 | let newEpisodes = episodes.filter({ $0.audio != nil }) 61 | if let first = newEpisodes.first, let url = first.audio { 62 | if !isPlayingNow() || episodes != newEpisodes { 63 | self.episodes = newEpisodes 64 | current = first 65 | avPlayer.replaceCurrentItem(with: AVPlayerItem(url: url)) 66 | state = .idle(episodes: newEpisodes) 67 | return 68 | } 69 | } 70 | } 71 | 72 | var hasEpisodes: Bool { 73 | return !episodes.isEmpty 74 | } 75 | 76 | func play() { 77 | guard let episode = current else { 78 | return 79 | } 80 | playNow(next: episode) 81 | } 82 | 83 | func pause() { 84 | pauseNow() 85 | } 86 | 87 | func previous() { 88 | guard let previousEpisode = previousEpisode() else { 89 | self.current = nil 90 | return 91 | } 92 | playNow(next: previousEpisode) 93 | } 94 | 95 | func next() { 96 | guard let nextEpisode = nextEpisode() else { 97 | self.current = nil 98 | return 99 | } 100 | self.playNow(next: nextEpisode) 101 | } 102 | 103 | var progress: Float { 104 | guard let playerDuration = avPlayer.currentItem?.duration else { return 0 } 105 | let totalTime = Float(CMTimeGetSeconds(playerDuration)) 106 | guard !totalTime.isNaN else { return 0 } 107 | let currentTime = Float(CMTimeGetSeconds(avPlayer.currentTime())) 108 | return currentTime / totalTime 109 | } 110 | 111 | // MARK: NotificationCenter 112 | 113 | @objc private func didPlayToEnd() { 114 | guard let next = nextEpisode() else { 115 | self.current = nil 116 | state = .finish(episodes: episodes) 117 | return 118 | } 119 | playNow(next: next) 120 | } 121 | 122 | // MARK: Player 123 | 124 | @objc private func didUpdatedPlayer(time: CMTime) { 125 | switch state { 126 | case .empty, .paused, .finish, .idle: 127 | return 128 | case .playing: 129 | break 130 | } 131 | guard let episode = current else { return } 132 | state = .playing(episode: episode, progress: progress) 133 | } 134 | 135 | // MARK: Private 136 | 137 | private func previousEpisode() -> Episode? { 138 | guard let current = self.current else { return nil } 139 | guard let curIndex = episodes.firstIndex(of: current) else { return nil } 140 | let target = curIndex - 1 141 | guard target >= 0 else { return self.current } 142 | return episodes[target] 143 | } 144 | 145 | private func nextEpisode() -> Episode? { 146 | guard let current = self.current else { return nil } 147 | guard let curIndex = episodes.firstIndex(of: current) else { return nil } 148 | let target = curIndex + 1 149 | guard target < episodes.count else { return nil } 150 | return episodes[target] 151 | } 152 | 153 | private func playNow(next: Episode) { 154 | guard let url = next.audio else { return } 155 | if current != next { 156 | self.avPlayer.replaceCurrentItem(with: AVPlayerItem(url: url)) 157 | } 158 | current = next 159 | avPlayer.play() 160 | notificationCenter.addObserver(self, selector: #selector(self.didArriveInterruption), name: AVAudioSession.interruptionNotification, object: nil) 161 | notifySystemPlayer(episode: next) 162 | state = .playing(episode: next, progress: progress) 163 | } 164 | 165 | private func pauseNow() { 166 | guard let episode = current else { return } 167 | self.avPlayer.pause() 168 | self.notificationCenter.removeObserver(self, name: AVAudioSession.interruptionNotification, object: nil) 169 | state = .paused(episode: episode, progress: progress) 170 | } 171 | 172 | private func isPlayingNow() -> Bool { 173 | return avPlayer.rate > 0 174 | } 175 | 176 | private func notifySystemPlayer(episode: Episode) { 177 | let info: [String: Any] = [ 178 | MPMediaItemPropertyTitle: episode.title, 179 | ] 180 | systemPlayer.nowPlayingInfo = info 181 | } 182 | 183 | // MARK: Interruptions 184 | 185 | @objc private func didArriveInterruption(notification: NSNotification) { 186 | if let value = notification.userInfo?[AVAudioSessionInterruptionTypeKey] as? NSNumber, 187 | let type = AVAudioSession.InterruptionType(rawValue: value.uintValue){ 188 | switch type { 189 | case .began: 190 | pause() 191 | case .ended: 192 | play() 193 | @unknown default: 194 | fatalError() 195 | } 196 | } 197 | } 198 | 199 | } 200 | -------------------------------------------------------------------------------- /Podcasts.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C307F2DA22ABEFEA001579EA /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F2D922ABEFEA001579EA /* HomeView.swift */; }; 11 | C307F2FC22AC18DA001579EA /* PodcastRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F2FB22AC18DA001579EA /* PodcastRow.swift */; }; 12 | C307F2FF22AC1933001579EA /* Previews.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F2FE22AC1933001579EA /* Previews.swift */; }; 13 | C307F30222AC1C0E001579EA /* PodcastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F30122AC1C0E001579EA /* PodcastView.swift */; }; 14 | C307F30522ACFF4B001579EA /* Episode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F30422ACFF4B001579EA /* Episode.swift */; }; 15 | C307F30B22AD01A1001579EA /* EpisodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F30A22AD01A1001579EA /* EpisodeView.swift */; }; 16 | C307F30D22AD42CF001579EA /* PodcastViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F30C22AD42CF001579EA /* PodcastViewModel.swift */; }; 17 | C307F30F22AD5E89001579EA /* EpisodeRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C307F30E22AD5E89001579EA /* EpisodeRow.swift */; }; 18 | C3870BB822AEAAF900EC3FEF /* UIImage+Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3870BB722AEAAF900EC3FEF /* UIImage+Color.swift */; }; 19 | C3968F0B22AA416C004CB76C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3968F0A22AA416C004CB76C /* AppDelegate.swift */; }; 20 | C3968F0D22AA416C004CB76C /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3968F0C22AA416C004CB76C /* SceneDelegate.swift */; }; 21 | C3968F0F22AA416C004CB76C /* PodcastsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3968F0E22AA416C004CB76C /* PodcastsView.swift */; }; 22 | C3968F1122AA416E004CB76C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3968F1022AA416E004CB76C /* Assets.xcassets */; }; 23 | C3968F1422AA416E004CB76C /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3968F1322AA416E004CB76C /* Preview Assets.xcassets */; }; 24 | C3968F1722AA416E004CB76C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3968F1522AA416E004CB76C /* LaunchScreen.storyboard */; }; 25 | C3968F2222AA416E004CB76C /* PodcastsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3968F2122AA416E004CB76C /* PodcastsTests.swift */; }; 26 | C3968F2E22AA4A33004CB76C /* PodcastsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3968F2D22AA4A33004CB76C /* PodcastsViewModel.swift */; }; 27 | C3A2BE6522AEC975003FFB3A /* ImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A2BE6422AEC975003FFB3A /* ImageLoader.swift */; }; 28 | C3B1FF9F22B834D100582250 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B1FF9E22B834D100582250 /* Container.swift */; }; 29 | C3B1FFA122B8351200582250 /* AppDelegate+Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B1FFA022B8351200582250 /* AppDelegate+Container.swift */; }; 30 | C3C2441822AE84440021050F /* Kingfisher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D56D0422AE81C600B0A948 /* Kingfisher.framework */; }; 31 | C3C2441C22AE86820021050F /* ImagesLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C2441B22AE86820021050F /* ImagesLoader.swift */; }; 32 | C3D56D0222AE7C7000B0A948 /* PodcastHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D56D0122AE7C7000B0A948 /* PodcastHeaderView.swift */; }; 33 | C3E1087822AFE15100F05D61 /* Date+Formatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E1087722AFE15100F05D61 /* Date+Formatter.swift */; }; 34 | C3E1087A22AFE24C00F05D61 /* Int+Timestamp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E1087922AFE24C00F05D61 /* Int+Timestamp.swift */; }; 35 | C3E1087D22AFFE0C00F05D61 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E1087C22AFFE0C00F05D61 /* Player.swift */; }; 36 | C3E3AFC722B8BF750038821F /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E3AFC622B8BF750038821F /* ProgressView.swift */; }; 37 | C3E3AFC922B8D3880038821F /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E3AFC822B8D3880038821F /* Constants.swift */; }; 38 | C3F51E7A22AF8A8C00279F4C /* Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F51E7922AF8A8C00279F4C /* Spinner.swift */; }; 39 | C3F5D70122B04FDC00C25132 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F5D70022B04FDC00C25132 /* PlayerView.swift */; }; 40 | C3FE2D0122AAACF300B814BE /* AnySubscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FE2D0022AAACF300B814BE /* AnySubscription.swift */; }; 41 | C3FE2D0522AAC40600B814BE /* PodcastRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FE2D0422AAC40600B814BE /* PodcastRepository.swift */; }; 42 | C3FE2D0B22AAC6B500B814BE /* Podcast.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FE2D0A22AAC6B500B814BE /* Podcast.swift */; }; 43 | /* End PBXBuildFile section */ 44 | 45 | /* Begin PBXContainerItemProxy section */ 46 | C3968F1E22AA416E004CB76C /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = C3968EFF22AA416C004CB76C /* Project object */; 49 | proxyType = 1; 50 | remoteGlobalIDString = C3968F0622AA416C004CB76C; 51 | remoteInfo = Podcasts; 52 | }; 53 | /* End PBXContainerItemProxy section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | C307F2D922ABEFEA001579EA /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = ""; }; 57 | C307F2FB22AC18DA001579EA /* PodcastRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastRow.swift; sourceTree = ""; }; 58 | C307F2FE22AC1933001579EA /* Previews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Previews.swift; sourceTree = ""; }; 59 | C307F30122AC1C0E001579EA /* PodcastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastView.swift; sourceTree = ""; }; 60 | C307F30422ACFF4B001579EA /* Episode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Episode.swift; sourceTree = ""; }; 61 | C307F30A22AD01A1001579EA /* EpisodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EpisodeView.swift; sourceTree = ""; }; 62 | C307F30C22AD42CF001579EA /* PodcastViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastViewModel.swift; sourceTree = ""; }; 63 | C307F30E22AD5E89001579EA /* EpisodeRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EpisodeRow.swift; sourceTree = ""; }; 64 | C3870BB722AEAAF900EC3FEF /* UIImage+Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+Color.swift"; sourceTree = ""; }; 65 | C3968F0722AA416C004CB76C /* Podcasts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Podcasts.app; sourceTree = BUILT_PRODUCTS_DIR; }; 66 | C3968F0A22AA416C004CB76C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 67 | C3968F0C22AA416C004CB76C /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 68 | C3968F0E22AA416C004CB76C /* PodcastsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastsView.swift; sourceTree = ""; }; 69 | C3968F1022AA416E004CB76C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 70 | C3968F1322AA416E004CB76C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 71 | C3968F1622AA416E004CB76C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 72 | C3968F1822AA416E004CB76C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 73 | C3968F1D22AA416E004CB76C /* PodcastsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PodcastsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 74 | C3968F2122AA416E004CB76C /* PodcastsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastsTests.swift; sourceTree = ""; }; 75 | C3968F2322AA416E004CB76C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 76 | C3968F2D22AA4A33004CB76C /* PodcastsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastsViewModel.swift; sourceTree = ""; }; 77 | C3A2BE6422AEC975003FFB3A /* ImageLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageLoader.swift; sourceTree = ""; }; 78 | C3B1FF9E22B834D100582250 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; 79 | C3B1FFA022B8351200582250 /* AppDelegate+Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+Container.swift"; sourceTree = ""; }; 80 | C3C2441B22AE86820021050F /* ImagesLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagesLoader.swift; sourceTree = ""; }; 81 | C3D56D0122AE7C7000B0A948 /* PodcastHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastHeaderView.swift; sourceTree = ""; }; 82 | C3D56D0422AE81C600B0A948 /* Kingfisher.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kingfisher.framework; path = Carthage/Build/iOS/Kingfisher.framework; sourceTree = ""; }; 83 | C3E1087722AFE15100F05D61 /* Date+Formatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Formatter.swift"; sourceTree = ""; }; 84 | C3E1087922AFE24C00F05D61 /* Int+Timestamp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Timestamp.swift"; sourceTree = ""; }; 85 | C3E1087C22AFFE0C00F05D61 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = ""; }; 86 | C3E3AFC622B8BF750038821F /* ProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressView.swift; sourceTree = ""; }; 87 | C3E3AFC822B8D3880038821F /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 88 | C3F51E7922AF8A8C00279F4C /* Spinner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Spinner.swift; sourceTree = ""; }; 89 | C3F5D70022B04FDC00C25132 /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; 90 | C3FE2D0022AAACF300B814BE /* AnySubscription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnySubscription.swift; sourceTree = ""; }; 91 | C3FE2D0422AAC40600B814BE /* PodcastRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PodcastRepository.swift; sourceTree = ""; }; 92 | C3FE2D0A22AAC6B500B814BE /* Podcast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Podcast.swift; sourceTree = ""; }; 93 | /* End PBXFileReference section */ 94 | 95 | /* Begin PBXFrameworksBuildPhase section */ 96 | C3968F0422AA416C004CB76C /* Frameworks */ = { 97 | isa = PBXFrameworksBuildPhase; 98 | buildActionMask = 2147483647; 99 | files = ( 100 | C3C2441822AE84440021050F /* Kingfisher.framework in Frameworks */, 101 | ); 102 | runOnlyForDeploymentPostprocessing = 0; 103 | }; 104 | C3968F1A22AA416E004CB76C /* Frameworks */ = { 105 | isa = PBXFrameworksBuildPhase; 106 | buildActionMask = 2147483647; 107 | files = ( 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | /* End PBXFrameworksBuildPhase section */ 112 | 113 | /* Begin PBXGroup section */ 114 | C307F30022AC1BF9001579EA /* Podcast */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | C307F30E22AD5E89001579EA /* EpisodeRow.swift */, 118 | C3D56D0122AE7C7000B0A948 /* PodcastHeaderView.swift */, 119 | C307F30122AC1C0E001579EA /* PodcastView.swift */, 120 | C307F30C22AD42CF001579EA /* PodcastViewModel.swift */, 121 | ); 122 | path = Podcast; 123 | sourceTree = ""; 124 | }; 125 | C307F30322ACFF35001579EA /* Models */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | C3FE2D0A22AAC6B500B814BE /* Podcast.swift */, 129 | C307F30422ACFF4B001579EA /* Episode.swift */, 130 | ); 131 | path = Models; 132 | sourceTree = ""; 133 | }; 134 | C307F30922AD0194001579EA /* Episode */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | C307F30A22AD01A1001579EA /* EpisodeView.swift */, 138 | ); 139 | path = Episode; 140 | sourceTree = ""; 141 | }; 142 | C347ED1322AD8A4C007837A1 /* Assets */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | C3968F1022AA416E004CB76C /* Assets.xcassets */, 146 | C3968F1522AA416E004CB76C /* LaunchScreen.storyboard */, 147 | ); 148 | path = Assets; 149 | sourceTree = ""; 150 | }; 151 | C3968EFE22AA416C004CB76C = { 152 | isa = PBXGroup; 153 | children = ( 154 | C3968F0922AA416C004CB76C /* Podcasts */, 155 | C3968F2022AA416E004CB76C /* PodcastsTests */, 156 | C3968F0822AA416C004CB76C /* Products */, 157 | C3D56D0322AE81C600B0A948 /* Frameworks */, 158 | ); 159 | sourceTree = ""; 160 | }; 161 | C3968F0822AA416C004CB76C /* Products */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | C3968F0722AA416C004CB76C /* Podcasts.app */, 165 | C3968F1D22AA416E004CB76C /* PodcastsTests.xctest */, 166 | ); 167 | name = Products; 168 | sourceTree = ""; 169 | }; 170 | C3968F0922AA416C004CB76C /* Podcasts */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | C3C2441D22AE868D0021050F /* Shared */, 174 | C347ED1322AD8A4C007837A1 /* Assets */, 175 | C3FE2D0722AAC63D00B814BE /* Scenes */, 176 | C3968F2C22AA4A25004CB76C /* Core */, 177 | C3968F0A22AA416C004CB76C /* AppDelegate.swift */, 178 | C3968F0C22AA416C004CB76C /* SceneDelegate.swift */, 179 | C3968F1822AA416E004CB76C /* Info.plist */, 180 | C3968F1222AA416E004CB76C /* Preview Content */, 181 | ); 182 | path = Podcasts; 183 | sourceTree = ""; 184 | }; 185 | C3968F1222AA416E004CB76C /* Preview Content */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | C307F2FE22AC1933001579EA /* Previews.swift */, 189 | C3968F1322AA416E004CB76C /* Preview Assets.xcassets */, 190 | ); 191 | path = "Preview Content"; 192 | sourceTree = ""; 193 | }; 194 | C3968F2022AA416E004CB76C /* PodcastsTests */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | C3968F2122AA416E004CB76C /* PodcastsTests.swift */, 198 | C3968F2322AA416E004CB76C /* Info.plist */, 199 | ); 200 | path = PodcastsTests; 201 | sourceTree = ""; 202 | }; 203 | C3968F2C22AA4A25004CB76C /* Core */ = { 204 | isa = PBXGroup; 205 | children = ( 206 | C3E1087B22AFFDFE00F05D61 /* Player */, 207 | C3FE2D0922AAC68D00B814BE /* Podcasts */, 208 | C3FE2D0622AAC60900B814BE /* Extensions */, 209 | C3FE2D0022AAACF300B814BE /* AnySubscription.swift */, 210 | ); 211 | path = Core; 212 | sourceTree = ""; 213 | }; 214 | C3C2441D22AE868D0021050F /* Shared */ = { 215 | isa = PBXGroup; 216 | children = ( 217 | C3C2441B22AE86820021050F /* ImagesLoader.swift */, 218 | C3870BB722AEAAF900EC3FEF /* UIImage+Color.swift */, 219 | C3A2BE6422AEC975003FFB3A /* ImageLoader.swift */, 220 | C3E1087722AFE15100F05D61 /* Date+Formatter.swift */, 221 | C3E1087922AFE24C00F05D61 /* Int+Timestamp.swift */, 222 | C3B1FF9E22B834D100582250 /* Container.swift */, 223 | C3B1FFA022B8351200582250 /* AppDelegate+Container.swift */, 224 | ); 225 | path = Shared; 226 | sourceTree = ""; 227 | }; 228 | C3D56D0322AE81C600B0A948 /* Frameworks */ = { 229 | isa = PBXGroup; 230 | children = ( 231 | C3D56D0422AE81C600B0A948 /* Kingfisher.framework */, 232 | ); 233 | name = Frameworks; 234 | sourceTree = ""; 235 | }; 236 | C3E1087B22AFFDFE00F05D61 /* Player */ = { 237 | isa = PBXGroup; 238 | children = ( 239 | C3E1087C22AFFE0C00F05D61 /* Player.swift */, 240 | ); 241 | path = Player; 242 | sourceTree = ""; 243 | }; 244 | C3F51E7822AF8A6700279F4C /* Views */ = { 245 | isa = PBXGroup; 246 | children = ( 247 | C3F51E7922AF8A8C00279F4C /* Spinner.swift */, 248 | C3E3AFC622B8BF750038821F /* ProgressView.swift */, 249 | ); 250 | path = Views; 251 | sourceTree = ""; 252 | }; 253 | C3F5D6FF22B04FC500C25132 /* Player */ = { 254 | isa = PBXGroup; 255 | children = ( 256 | C3F5D70022B04FDC00C25132 /* PlayerView.swift */, 257 | ); 258 | path = Player; 259 | sourceTree = ""; 260 | }; 261 | C3FE2D0622AAC60900B814BE /* Extensions */ = { 262 | isa = PBXGroup; 263 | children = ( 264 | ); 265 | path = Extensions; 266 | sourceTree = ""; 267 | }; 268 | C3FE2D0722AAC63D00B814BE /* Scenes */ = { 269 | isa = PBXGroup; 270 | children = ( 271 | C3F5D6FF22B04FC500C25132 /* Player */, 272 | C3F51E7822AF8A6700279F4C /* Views */, 273 | C307F30922AD0194001579EA /* Episode */, 274 | C307F30022AC1BF9001579EA /* Podcast */, 275 | C3FE2D0822AAC64400B814BE /* Podcasts */, 276 | C307F2D922ABEFEA001579EA /* HomeView.swift */, 277 | ); 278 | path = Scenes; 279 | sourceTree = ""; 280 | }; 281 | C3FE2D0822AAC64400B814BE /* Podcasts */ = { 282 | isa = PBXGroup; 283 | children = ( 284 | C3968F0E22AA416C004CB76C /* PodcastsView.swift */, 285 | C3968F2D22AA4A33004CB76C /* PodcastsViewModel.swift */, 286 | C307F2FB22AC18DA001579EA /* PodcastRow.swift */, 287 | ); 288 | path = Podcasts; 289 | sourceTree = ""; 290 | }; 291 | C3FE2D0922AAC68D00B814BE /* Podcasts */ = { 292 | isa = PBXGroup; 293 | children = ( 294 | C307F30322ACFF35001579EA /* Models */, 295 | C3FE2D0422AAC40600B814BE /* PodcastRepository.swift */, 296 | C3E3AFC822B8D3880038821F /* Constants.swift */, 297 | ); 298 | path = Podcasts; 299 | sourceTree = ""; 300 | }; 301 | /* End PBXGroup section */ 302 | 303 | /* Begin PBXNativeTarget section */ 304 | C3968F0622AA416C004CB76C /* Podcasts */ = { 305 | isa = PBXNativeTarget; 306 | buildConfigurationList = C3968F2622AA416E004CB76C /* Build configuration list for PBXNativeTarget "Podcasts" */; 307 | buildPhases = ( 308 | C3968F0322AA416C004CB76C /* Sources */, 309 | C3968F0422AA416C004CB76C /* Frameworks */, 310 | C3968F0522AA416C004CB76C /* Resources */, 311 | C3D56D0822AE81D300B0A948 /* Carthage */, 312 | ); 313 | buildRules = ( 314 | ); 315 | dependencies = ( 316 | ); 317 | name = Podcasts; 318 | productName = Podcasts; 319 | productReference = C3968F0722AA416C004CB76C /* Podcasts.app */; 320 | productType = "com.apple.product-type.application"; 321 | }; 322 | C3968F1C22AA416E004CB76C /* PodcastsTests */ = { 323 | isa = PBXNativeTarget; 324 | buildConfigurationList = C3968F2922AA416E004CB76C /* Build configuration list for PBXNativeTarget "PodcastsTests" */; 325 | buildPhases = ( 326 | C3968F1922AA416E004CB76C /* Sources */, 327 | C3968F1A22AA416E004CB76C /* Frameworks */, 328 | C3968F1B22AA416E004CB76C /* Resources */, 329 | ); 330 | buildRules = ( 331 | ); 332 | dependencies = ( 333 | C3968F1F22AA416E004CB76C /* PBXTargetDependency */, 334 | ); 335 | name = PodcastsTests; 336 | productName = PodcastsTests; 337 | productReference = C3968F1D22AA416E004CB76C /* PodcastsTests.xctest */; 338 | productType = "com.apple.product-type.bundle.unit-test"; 339 | }; 340 | /* End PBXNativeTarget section */ 341 | 342 | /* Begin PBXProject section */ 343 | C3968EFF22AA416C004CB76C /* Project object */ = { 344 | isa = PBXProject; 345 | attributes = { 346 | LastSwiftUpdateCheck = 1100; 347 | LastUpgradeCheck = 1100; 348 | ORGANIZATIONNAME = com.github.albertopeam; 349 | TargetAttributes = { 350 | C3968F0622AA416C004CB76C = { 351 | CreatedOnToolsVersion = 11.0; 352 | }; 353 | C3968F1C22AA416E004CB76C = { 354 | CreatedOnToolsVersion = 11.0; 355 | TestTargetID = C3968F0622AA416C004CB76C; 356 | }; 357 | }; 358 | }; 359 | buildConfigurationList = C3968F0222AA416C004CB76C /* Build configuration list for PBXProject "Podcasts" */; 360 | compatibilityVersion = "Xcode 9.3"; 361 | developmentRegion = en; 362 | hasScannedForEncodings = 0; 363 | knownRegions = ( 364 | en, 365 | Base, 366 | ); 367 | mainGroup = C3968EFE22AA416C004CB76C; 368 | productRefGroup = C3968F0822AA416C004CB76C /* Products */; 369 | projectDirPath = ""; 370 | projectRoot = ""; 371 | targets = ( 372 | C3968F0622AA416C004CB76C /* Podcasts */, 373 | C3968F1C22AA416E004CB76C /* PodcastsTests */, 374 | ); 375 | }; 376 | /* End PBXProject section */ 377 | 378 | /* Begin PBXResourcesBuildPhase section */ 379 | C3968F0522AA416C004CB76C /* Resources */ = { 380 | isa = PBXResourcesBuildPhase; 381 | buildActionMask = 2147483647; 382 | files = ( 383 | C3968F1722AA416E004CB76C /* LaunchScreen.storyboard in Resources */, 384 | C3968F1422AA416E004CB76C /* Preview Assets.xcassets in Resources */, 385 | C3968F1122AA416E004CB76C /* Assets.xcassets in Resources */, 386 | ); 387 | runOnlyForDeploymentPostprocessing = 0; 388 | }; 389 | C3968F1B22AA416E004CB76C /* Resources */ = { 390 | isa = PBXResourcesBuildPhase; 391 | buildActionMask = 2147483647; 392 | files = ( 393 | ); 394 | runOnlyForDeploymentPostprocessing = 0; 395 | }; 396 | /* End PBXResourcesBuildPhase section */ 397 | 398 | /* Begin PBXShellScriptBuildPhase section */ 399 | C3D56D0822AE81D300B0A948 /* Carthage */ = { 400 | isa = PBXShellScriptBuildPhase; 401 | buildActionMask = 2147483647; 402 | files = ( 403 | ); 404 | inputFileListPaths = ( 405 | ); 406 | inputPaths = ( 407 | "$(SRCROOT)/Carthage/Build/iOS/Kingfisher.framework", 408 | ); 409 | name = Carthage; 410 | outputFileListPaths = ( 411 | ); 412 | outputPaths = ( 413 | "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Kingfisher.framework", 414 | ); 415 | runOnlyForDeploymentPostprocessing = 0; 416 | shellPath = /bin/sh; 417 | shellScript = "/usr/local/bin/carthage copy-frameworks\n"; 418 | }; 419 | /* End PBXShellScriptBuildPhase section */ 420 | 421 | /* Begin PBXSourcesBuildPhase section */ 422 | C3968F0322AA416C004CB76C /* Sources */ = { 423 | isa = PBXSourcesBuildPhase; 424 | buildActionMask = 2147483647; 425 | files = ( 426 | C307F2DA22ABEFEA001579EA /* HomeView.swift in Sources */, 427 | C3968F0B22AA416C004CB76C /* AppDelegate.swift in Sources */, 428 | C3A2BE6522AEC975003FFB3A /* ImageLoader.swift in Sources */, 429 | C3968F0D22AA416C004CB76C /* SceneDelegate.swift in Sources */, 430 | C3E1087D22AFFE0C00F05D61 /* Player.swift in Sources */, 431 | C3E3AFC922B8D3880038821F /* Constants.swift in Sources */, 432 | C307F2FF22AC1933001579EA /* Previews.swift in Sources */, 433 | C3B1FFA122B8351200582250 /* AppDelegate+Container.swift in Sources */, 434 | C307F30B22AD01A1001579EA /* EpisodeView.swift in Sources */, 435 | C3870BB822AEAAF900EC3FEF /* UIImage+Color.swift in Sources */, 436 | C3F5D70122B04FDC00C25132 /* PlayerView.swift in Sources */, 437 | C3C2441C22AE86820021050F /* ImagesLoader.swift in Sources */, 438 | C3D56D0222AE7C7000B0A948 /* PodcastHeaderView.swift in Sources */, 439 | C307F2FC22AC18DA001579EA /* PodcastRow.swift in Sources */, 440 | C3F51E7A22AF8A8C00279F4C /* Spinner.swift in Sources */, 441 | C307F30222AC1C0E001579EA /* PodcastView.swift in Sources */, 442 | C3E1087A22AFE24C00F05D61 /* Int+Timestamp.swift in Sources */, 443 | C3E1087822AFE15100F05D61 /* Date+Formatter.swift in Sources */, 444 | C3FE2D0B22AAC6B500B814BE /* Podcast.swift in Sources */, 445 | C307F30522ACFF4B001579EA /* Episode.swift in Sources */, 446 | C307F30D22AD42CF001579EA /* PodcastViewModel.swift in Sources */, 447 | C3968F2E22AA4A33004CB76C /* PodcastsViewModel.swift in Sources */, 448 | C307F30F22AD5E89001579EA /* EpisodeRow.swift in Sources */, 449 | C3FE2D0122AAACF300B814BE /* AnySubscription.swift in Sources */, 450 | C3B1FF9F22B834D100582250 /* Container.swift in Sources */, 451 | C3E3AFC722B8BF750038821F /* ProgressView.swift in Sources */, 452 | C3FE2D0522AAC40600B814BE /* PodcastRepository.swift in Sources */, 453 | C3968F0F22AA416C004CB76C /* PodcastsView.swift in Sources */, 454 | ); 455 | runOnlyForDeploymentPostprocessing = 0; 456 | }; 457 | C3968F1922AA416E004CB76C /* Sources */ = { 458 | isa = PBXSourcesBuildPhase; 459 | buildActionMask = 2147483647; 460 | files = ( 461 | C3968F2222AA416E004CB76C /* PodcastsTests.swift in Sources */, 462 | ); 463 | runOnlyForDeploymentPostprocessing = 0; 464 | }; 465 | /* End PBXSourcesBuildPhase section */ 466 | 467 | /* Begin PBXTargetDependency section */ 468 | C3968F1F22AA416E004CB76C /* PBXTargetDependency */ = { 469 | isa = PBXTargetDependency; 470 | target = C3968F0622AA416C004CB76C /* Podcasts */; 471 | targetProxy = C3968F1E22AA416E004CB76C /* PBXContainerItemProxy */; 472 | }; 473 | /* End PBXTargetDependency section */ 474 | 475 | /* Begin PBXVariantGroup section */ 476 | C3968F1522AA416E004CB76C /* LaunchScreen.storyboard */ = { 477 | isa = PBXVariantGroup; 478 | children = ( 479 | C3968F1622AA416E004CB76C /* Base */, 480 | ); 481 | name = LaunchScreen.storyboard; 482 | sourceTree = ""; 483 | }; 484 | /* End PBXVariantGroup section */ 485 | 486 | /* Begin XCBuildConfiguration section */ 487 | C3968F2422AA416E004CB76C /* Debug */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | ALWAYS_SEARCH_USER_PATHS = NO; 491 | CLANG_ANALYZER_NONNULL = YES; 492 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 493 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 494 | CLANG_CXX_LIBRARY = "libc++"; 495 | CLANG_ENABLE_MODULES = YES; 496 | CLANG_ENABLE_OBJC_ARC = YES; 497 | CLANG_ENABLE_OBJC_WEAK = YES; 498 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 499 | CLANG_WARN_BOOL_CONVERSION = YES; 500 | CLANG_WARN_COMMA = YES; 501 | CLANG_WARN_CONSTANT_CONVERSION = YES; 502 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 503 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 504 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 505 | CLANG_WARN_EMPTY_BODY = YES; 506 | CLANG_WARN_ENUM_CONVERSION = YES; 507 | CLANG_WARN_INFINITE_RECURSION = YES; 508 | CLANG_WARN_INT_CONVERSION = YES; 509 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 510 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 511 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 512 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 513 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 514 | CLANG_WARN_STRICT_PROTOTYPES = YES; 515 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 516 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 517 | CLANG_WARN_UNREACHABLE_CODE = YES; 518 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 519 | COPY_PHASE_STRIP = NO; 520 | DEBUG_INFORMATION_FORMAT = dwarf; 521 | ENABLE_STRICT_OBJC_MSGSEND = YES; 522 | ENABLE_TESTABILITY = YES; 523 | GCC_C_LANGUAGE_STANDARD = gnu11; 524 | GCC_DYNAMIC_NO_PIC = NO; 525 | GCC_NO_COMMON_BLOCKS = YES; 526 | GCC_OPTIMIZATION_LEVEL = 0; 527 | GCC_PREPROCESSOR_DEFINITIONS = ( 528 | "DEBUG=1", 529 | "$(inherited)", 530 | ); 531 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 532 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 533 | GCC_WARN_UNDECLARED_SELECTOR = YES; 534 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 535 | GCC_WARN_UNUSED_FUNCTION = YES; 536 | GCC_WARN_UNUSED_VARIABLE = YES; 537 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 538 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 539 | MTL_FAST_MATH = YES; 540 | ONLY_ACTIVE_ARCH = YES; 541 | SDKROOT = iphoneos; 542 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 543 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 544 | }; 545 | name = Debug; 546 | }; 547 | C3968F2522AA416E004CB76C /* Release */ = { 548 | isa = XCBuildConfiguration; 549 | buildSettings = { 550 | ALWAYS_SEARCH_USER_PATHS = NO; 551 | CLANG_ANALYZER_NONNULL = YES; 552 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 553 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 554 | CLANG_CXX_LIBRARY = "libc++"; 555 | CLANG_ENABLE_MODULES = YES; 556 | CLANG_ENABLE_OBJC_ARC = YES; 557 | CLANG_ENABLE_OBJC_WEAK = YES; 558 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 559 | CLANG_WARN_BOOL_CONVERSION = YES; 560 | CLANG_WARN_COMMA = YES; 561 | CLANG_WARN_CONSTANT_CONVERSION = YES; 562 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 563 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 564 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 565 | CLANG_WARN_EMPTY_BODY = YES; 566 | CLANG_WARN_ENUM_CONVERSION = YES; 567 | CLANG_WARN_INFINITE_RECURSION = YES; 568 | CLANG_WARN_INT_CONVERSION = YES; 569 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 570 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 571 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 572 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 573 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 574 | CLANG_WARN_STRICT_PROTOTYPES = YES; 575 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 576 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 577 | CLANG_WARN_UNREACHABLE_CODE = YES; 578 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 579 | COPY_PHASE_STRIP = NO; 580 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 581 | ENABLE_NS_ASSERTIONS = NO; 582 | ENABLE_STRICT_OBJC_MSGSEND = YES; 583 | GCC_C_LANGUAGE_STANDARD = gnu11; 584 | GCC_NO_COMMON_BLOCKS = YES; 585 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 586 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 587 | GCC_WARN_UNDECLARED_SELECTOR = YES; 588 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 589 | GCC_WARN_UNUSED_FUNCTION = YES; 590 | GCC_WARN_UNUSED_VARIABLE = YES; 591 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 592 | MTL_ENABLE_DEBUG_INFO = NO; 593 | MTL_FAST_MATH = YES; 594 | SDKROOT = iphoneos; 595 | SWIFT_COMPILATION_MODE = wholemodule; 596 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 597 | VALIDATE_PRODUCT = YES; 598 | }; 599 | name = Release; 600 | }; 601 | C3968F2722AA416E004CB76C /* Debug */ = { 602 | isa = XCBuildConfiguration; 603 | buildSettings = { 604 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 605 | CODE_SIGN_STYLE = Manual; 606 | DEVELOPMENT_ASSET_PATHS = "Podcasts/Preview\\ Content"; 607 | DEVELOPMENT_TEAM = ""; 608 | ENABLE_PREVIEWS = YES; 609 | FRAMEWORK_SEARCH_PATHS = ( 610 | "$(inherited)", 611 | "$(PROJECT_DIR)/Carthage/Build/iOS", 612 | ); 613 | INFOPLIST_FILE = Podcasts/Info.plist; 614 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 615 | LD_RUNPATH_SEARCH_PATHS = ( 616 | "$(inherited)", 617 | "@executable_path/Frameworks", 618 | ); 619 | PRODUCT_BUNDLE_IDENTIFIER = com.github.albertopeam.Podcasts; 620 | PRODUCT_NAME = "$(TARGET_NAME)"; 621 | PROVISIONING_PROFILE_SPECIFIER = ""; 622 | SWIFT_VERSION = 5.0; 623 | TARGETED_DEVICE_FAMILY = 1; 624 | }; 625 | name = Debug; 626 | }; 627 | C3968F2822AA416E004CB76C /* Release */ = { 628 | isa = XCBuildConfiguration; 629 | buildSettings = { 630 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 631 | CODE_SIGN_STYLE = Manual; 632 | DEVELOPMENT_ASSET_PATHS = "Podcasts/Preview\\ Content"; 633 | DEVELOPMENT_TEAM = ""; 634 | ENABLE_PREVIEWS = YES; 635 | FRAMEWORK_SEARCH_PATHS = ( 636 | "$(inherited)", 637 | "$(PROJECT_DIR)/Carthage/Build/iOS", 638 | ); 639 | INFOPLIST_FILE = Podcasts/Info.plist; 640 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 641 | LD_RUNPATH_SEARCH_PATHS = ( 642 | "$(inherited)", 643 | "@executable_path/Frameworks", 644 | ); 645 | PRODUCT_BUNDLE_IDENTIFIER = com.github.albertopeam.Podcasts; 646 | PRODUCT_NAME = "$(TARGET_NAME)"; 647 | PROVISIONING_PROFILE_SPECIFIER = ""; 648 | SWIFT_VERSION = 5.0; 649 | TARGETED_DEVICE_FAMILY = 1; 650 | }; 651 | name = Release; 652 | }; 653 | C3968F2A22AA416E004CB76C /* Debug */ = { 654 | isa = XCBuildConfiguration; 655 | buildSettings = { 656 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 657 | BUNDLE_LOADER = "$(TEST_HOST)"; 658 | CODE_SIGN_STYLE = Automatic; 659 | DEVELOPMENT_TEAM = EAL5PKWJ89; 660 | INFOPLIST_FILE = PodcastsTests/Info.plist; 661 | LD_RUNPATH_SEARCH_PATHS = ( 662 | "$(inherited)", 663 | "@executable_path/Frameworks", 664 | "@loader_path/Frameworks", 665 | ); 666 | PRODUCT_BUNDLE_IDENTIFIER = com.github.albertopeam.PodcastsTests; 667 | PRODUCT_NAME = "$(TARGET_NAME)"; 668 | SWIFT_VERSION = 5.0; 669 | TARGETED_DEVICE_FAMILY = "1,2"; 670 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Podcasts.app/Podcasts"; 671 | }; 672 | name = Debug; 673 | }; 674 | C3968F2B22AA416E004CB76C /* Release */ = { 675 | isa = XCBuildConfiguration; 676 | buildSettings = { 677 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 678 | BUNDLE_LOADER = "$(TEST_HOST)"; 679 | CODE_SIGN_STYLE = Automatic; 680 | DEVELOPMENT_TEAM = EAL5PKWJ89; 681 | INFOPLIST_FILE = PodcastsTests/Info.plist; 682 | LD_RUNPATH_SEARCH_PATHS = ( 683 | "$(inherited)", 684 | "@executable_path/Frameworks", 685 | "@loader_path/Frameworks", 686 | ); 687 | PRODUCT_BUNDLE_IDENTIFIER = com.github.albertopeam.PodcastsTests; 688 | PRODUCT_NAME = "$(TARGET_NAME)"; 689 | SWIFT_VERSION = 5.0; 690 | TARGETED_DEVICE_FAMILY = "1,2"; 691 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Podcasts.app/Podcasts"; 692 | }; 693 | name = Release; 694 | }; 695 | /* End XCBuildConfiguration section */ 696 | 697 | /* Begin XCConfigurationList section */ 698 | C3968F0222AA416C004CB76C /* Build configuration list for PBXProject "Podcasts" */ = { 699 | isa = XCConfigurationList; 700 | buildConfigurations = ( 701 | C3968F2422AA416E004CB76C /* Debug */, 702 | C3968F2522AA416E004CB76C /* Release */, 703 | ); 704 | defaultConfigurationIsVisible = 0; 705 | defaultConfigurationName = Release; 706 | }; 707 | C3968F2622AA416E004CB76C /* Build configuration list for PBXNativeTarget "Podcasts" */ = { 708 | isa = XCConfigurationList; 709 | buildConfigurations = ( 710 | C3968F2722AA416E004CB76C /* Debug */, 711 | C3968F2822AA416E004CB76C /* Release */, 712 | ); 713 | defaultConfigurationIsVisible = 0; 714 | defaultConfigurationName = Release; 715 | }; 716 | C3968F2922AA416E004CB76C /* Build configuration list for PBXNativeTarget "PodcastsTests" */ = { 717 | isa = XCConfigurationList; 718 | buildConfigurations = ( 719 | C3968F2A22AA416E004CB76C /* Debug */, 720 | C3968F2B22AA416E004CB76C /* Release */, 721 | ); 722 | defaultConfigurationIsVisible = 0; 723 | defaultConfigurationName = Release; 724 | }; 725 | /* End XCConfigurationList section */ 726 | }; 727 | rootObject = C3968EFF22AA416C004CB76C /* Project object */; 728 | } 729 | --------------------------------------------------------------------------------