Full Code of TheCodeMonks/NYTimes-iOS for AI

master 7a60237c47a7 cached
47 files
106.5 KB
31.3k tokens
1 requests
Download .txt
Repository: TheCodeMonks/NYTimes-iOS
Branch: master
Commit: 7a60237c47a7
Files: 47
Total size: 106.5 KB

Directory structure:
gitextract_b4frkyue/

├── .github/
│   └── FUNDING.yml
├── LICENSE
├── NYTimes/
│   ├── Assets.xcassets/
│   │   ├── AppIcon.appiconset/
│   │   │   └── Contents.json
│   │   ├── Contents.json
│   │   └── categoryBackground.colorset/
│   │       └── Contents.json
│   ├── Extensions/
│   │   └── Reachability + Extensions.swift
│   ├── Globals/
│   │   └── Constants.swift
│   ├── Info.plist
│   ├── Model/
│   │   ├── Article.swift
│   │   ├── Bookmark.swift
│   │   ├── Category.swift
│   │   └── Coredata model/
│   │       ├── CDArticle+CoreDataClass.swift
│   │       └── CDArticle+CoreDataProperties.swift
│   ├── Persistence/
│   │   ├── NYTimes.xcdatamodeld/
│   │   │   ├── .xccurrentversion
│   │   │   └── NYTimes.xcdatamodel/
│   │   │       └── contents
│   │   └── PersistenceManager.swift
│   ├── Preview Content/
│   │   └── Preview Assets.xcassets/
│   │       └── Contents.json
│   ├── Repository/
│   │   └── BookmarkRepository.swift
│   ├── Supporting files/
│   │   ├── AppDelegate.swift
│   │   ├── Base.lproj/
│   │   │   └── LaunchScreen.storyboard
│   │   └── SceneDelegate.swift
│   ├── Utilities/
│   │   ├── Common Utils.swift
│   │   ├── HTMLScarperUtility.swift
│   │   └── NetworkReachabilty.swift
│   ├── ViewModel/
│   │   ├── ArticleViewModel.swift
│   │   └── BookmarkViewModel.swift
│   └── Views/
│       ├── BookmarksView.swift
│       ├── Categories/
│       │   ├── CategoriesView.swift
│       │   └── CategoriesViewModel.swift
│       ├── CategorySelector.swift
│       ├── NewsFeedView.swift
│       ├── RootView.swift
│       ├── WebView.swift
│       └── WebViewHolder.swift
├── NYTimes.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   ├── xcshareddata/
│   │   │   ├── IDEWorkspaceChecks.plist
│   │   │   └── swiftpm/
│   │   │       └── Package.resolved
│   │   └── xcuserdata/
│   │       └── sameernawaz.xcuserdatad/
│   │           └── UserInterfaceState.xcuserstate
│   ├── xcshareddata/
│   │   └── xcschemes/
│   │       └── NYTimes.xcscheme
│   └── xcuserdata/
│       ├── sameernawaz.xcuserdatad/
│       │   └── xcdebugger/
│       │       └── Breakpoints_v2.xcbkptlist
│       └── waseemakram.xcuserdatad/
│           ├── xcdebugger/
│           │   └── Breakpoints_v2.xcbkptlist
│           └── xcschemes/
│               └── xcschememanagement.plist
├── NYTimesTests/
│   ├── ArticleRepositoryTest.swift
│   ├── NYTimesTestInfo.plist
│   └── NYTimesTests.swift
└── README.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

github: devwaseem # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://www.paypal.me/iamwaseem99 # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2020 The Code Monks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: NYTimes/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
  "images" : [
    {
      "filename" : "40.png",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "20x20"
    },
    {
      "filename" : "60.png",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "20x20"
    },
    {
      "filename" : "29.png",
      "idiom" : "iphone",
      "scale" : "1x",
      "size" : "29x29"
    },
    {
      "filename" : "58.png",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "29x29"
    },
    {
      "filename" : "87.png",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "29x29"
    },
    {
      "filename" : "80.png",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "40x40"
    },
    {
      "filename" : "120.png",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "40x40"
    },
    {
      "filename" : "57.png",
      "idiom" : "iphone",
      "scale" : "1x",
      "size" : "57x57"
    },
    {
      "filename" : "114.png",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "57x57"
    },
    {
      "filename" : "120.png",
      "idiom" : "iphone",
      "scale" : "2x",
      "size" : "60x60"
    },
    {
      "filename" : "180.png",
      "idiom" : "iphone",
      "scale" : "3x",
      "size" : "60x60"
    },
    {
      "filename" : "20.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "20x20"
    },
    {
      "filename" : "40.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "20x20"
    },
    {
      "filename" : "29.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "29x29"
    },
    {
      "filename" : "58.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "29x29"
    },
    {
      "filename" : "40.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "40x40"
    },
    {
      "filename" : "80.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "40x40"
    },
    {
      "filename" : "50.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "50x50"
    },
    {
      "filename" : "100.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "50x50"
    },
    {
      "filename" : "72.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "72x72"
    },
    {
      "filename" : "144.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "72x72"
    },
    {
      "filename" : "76.png",
      "idiom" : "ipad",
      "scale" : "1x",
      "size" : "76x76"
    },
    {
      "filename" : "152.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "76x76"
    },
    {
      "filename" : "167.png",
      "idiom" : "ipad",
      "scale" : "2x",
      "size" : "83.5x83.5"
    },
    {
      "filename" : "1024.png",
      "idiom" : "ios-marketing",
      "scale" : "1x",
      "size" : "1024x1024"
    },
    {
      "filename" : "16.png",
      "idiom" : "mac",
      "scale" : "1x",
      "size" : "16x16"
    },
    {
      "filename" : "32.png",
      "idiom" : "mac",
      "scale" : "2x",
      "size" : "16x16"
    },
    {
      "filename" : "32.png",
      "idiom" : "mac",
      "scale" : "1x",
      "size" : "32x32"
    },
    {
      "filename" : "64.png",
      "idiom" : "mac",
      "scale" : "2x",
      "size" : "32x32"
    },
    {
      "filename" : "128.png",
      "idiom" : "mac",
      "scale" : "1x",
      "size" : "128x128"
    },
    {
      "filename" : "256.png",
      "idiom" : "mac",
      "scale" : "2x",
      "size" : "128x128"
    },
    {
      "filename" : "256.png",
      "idiom" : "mac",
      "scale" : "1x",
      "size" : "256x256"
    },
    {
      "filename" : "512.png",
      "idiom" : "mac",
      "scale" : "2x",
      "size" : "256x256"
    },
    {
      "filename" : "512.png",
      "idiom" : "mac",
      "scale" : "1x",
      "size" : "512x512"
    },
    {
      "filename" : "1024.png",
      "idiom" : "mac",
      "scale" : "2x",
      "size" : "512x512"
    }
  ],
  "info" : {
    "author" : "xcode",
    "version" : 1
  }
}


================================================
FILE: NYTimes/Assets.xcassets/Contents.json
================================================
{
  "info" : {
    "author" : "xcode",
    "version" : 1
  }
}


================================================
FILE: NYTimes/Assets.xcassets/categoryBackground.colorset/Contents.json
================================================
{
  "colors" : [
    {
      "color" : {
        "color-space" : "srgb",
        "components" : {
          "alpha" : "1.000",
          "blue" : "0xFF",
          "green" : "0xFF",
          "red" : "0xFF"
        }
      },
      "idiom" : "universal"
    },
    {
      "appearances" : [
        {
          "appearance" : "luminosity",
          "value" : "dark"
        }
      ],
      "color" : {
        "color-space" : "srgb",
        "components" : {
          "alpha" : "1.000",
          "blue" : "0x12",
          "green" : "0x12",
          "red" : "0x12"
        }
      },
      "idiom" : "universal"
    }
  ],
  "info" : {
    "author" : "xcode",
    "version" : 1
  }
}


================================================
FILE: NYTimes/Extensions/Reachability + Extensions.swift
================================================
//
//  Reachability + Extensions.swift
//  NYTimes
//
//  Created by Waseem Akram on 18/11/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import Reachability
import Combine


extension Reachability {
    
    var onReachabilityChanged: AnyPublisher<Reachability, Never> {
        NotificationCenter.default
            .publisher(for: .reachabilityChanged, object: self)
            .compactMap {
                $0.object as? Reachability
            }
            .eraseToAnyPublisher()
    }
    
    
    var status: AnyPublisher<Connection, Never> {
        onReachabilityChanged
            .map(\.connection)
            .eraseToAnyPublisher()
    }
    
    var isReachable: AnyPublisher<Bool, Never> {
        onReachabilityChanged
            .map { $0.connection != .unavailable }
            .eraseToAnyPublisher()
    }
    
    var isConnected: AnyPublisher<Void, Never> {
        isReachable
            .filter { $0 }
            .map { _ in }
            .eraseToAnyPublisher()
    }
    
    var isDisconnected: AnyPublisher<Void, Never> {
        isReachable
            .filter { !$0 }
            .map { _ in }
            .eraseToAnyPublisher()
    }
    
}


================================================
FILE: NYTimes/Globals/Constants.swift
================================================
//
//  Commons.swift
//  NYTimes
//
//  Created by Waseem Akram on 31/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation

class Constants {
    
    class Endpoints {
        static let BASEURL = "https://www.nytimes.com"
    }

    struct UserDefaults {
        static let categories = "UD_CATEGORIES"
    }
}


class PlaceHolderData {
    
    static let articles = [
        Article(
            url: "https://www.nytimes.com/2020/07/28/science/nasa-jezero-perseverance.html",
            imageUrl: "https://static01.nyt.com/images/2020/07/28/science/28SCI-MARS-JEZERO1/28SCI-MARS-JEZERO1-jumbo.jpg",
            title: "How NASA Found the Ideal Hole on Mars to Land In",
            subtitle: "Jezero crater, the destination of the Perseverance rover, is a promising place to look for evidence of extinct Martian life.",
            author: "KENNETH CHANG"
        ),
        Article(
            url: "https://www.nytimes.com/2020/07/28/science/virgin-galactic-cabin.html",
            imageUrl: "https://static01.nyt.com/images/2020/07/28/science/28VIRGINGALACTIC2/28VIRGINGALACTIC2-videoLarge.jpg",
            title: "Virgin Galactic Unveils Comfy Cabin for Jet-Setting to the Edge of Space",
            subtitle: "Passengers able to pay hundreds of thousands of dollars for a seat can escape gravity for a few minutes.",
            author: "KENNETH CHANG"
        ),
        Article(
            url: "https://www.nytimes.com/2020/07/28/science/microbes-100-million-years-old.html",
            imageUrl: "https://static01.nyt.com/images/2020/07/28/science/28ANCIENT-MICROBES2/28ANCIENT-MICROBES2-videoLarge.jpg",
            title: "These Microbes May Have Survived 100 Million Years Beneath the Seafloor",
            subtitle: "Rescued from their cold, cramped and nutrient-poor homes, the bacteria awoke in the lab and grew.",
            author: "KATHERINE J. WU"
        )
    ]
}


================================================
FILE: NYTimes/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UIApplicationSceneManifest</key>
	<dict>
		<key>UIApplicationSupportsMultipleScenes</key>
		<false/>
		<key>UISceneConfigurations</key>
		<dict>
			<key>UIWindowSceneSessionRoleApplication</key>
			<array>
				<dict>
					<key>UISceneConfigurationName</key>
					<string>Default Configuration</string>
					<key>UISceneDelegateClassName</key>
					<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
				</dict>
			</array>
		</dict>
	</dict>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
</dict>
</plist>


================================================
FILE: NYTimes/Model/Article.swift
================================================
//
//  Article.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation

public class Article:NSObject,Codable,Identifiable {
    
    public var id: UUID
    var url: String
    var title: String
    var subtitle: String
    var author: String
    var imageUrl:String
    
    
    init(id: UUID = UUID(),url: String, imageUrl:String,title: String, subtitle: String, author: String) {
        self.id = id
        self.url = url
        self.title = title
        self.subtitle = subtitle
        self.author = author
        self.imageUrl = imageUrl
    }
    
    init(from dataArticle:CDArticle){
        self.id = dataArticle.id
        self.url = dataArticle.url
        self.title = dataArticle.title
        self.subtitle = dataArticle.subtitle
        self.author = dataArticle.author
        self.imageUrl = dataArticle.imageUrl
    }
    
   
    static var placeholder = Article(url: "Url", imageUrl: "imageUrl", title: String(repeating: "Title", count: 5), subtitle: String(repeating: "Subtitle", count: 10), author: String(repeating: "Author", count: 3))
    
}



================================================
FILE: NYTimes/Model/Bookmark.swift
================================================
//
//  Bookmark.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation

 struct Bookmark {
    var id: UUID
    var article:Article
    var index: Int16
    
     init(id: UUID = UUID(), article: Article, index: Int16) {
        self.id = id
        self.article = article
        self.index = index
    }
}


================================================
FILE: NYTimes/Model/Category.swift
================================================
//
//  Category.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation

enum Category: String, CaseIterable {
    
    case tech = "Tech"
    case science = "Science"
    case business = "Business"
    case yourmoney = "Your Money"
    case education = "Education"
    case sports = "Sports"
    case space = "Space"
    
    var url: String {
        switch self {
        case .science : return "https://www.nytimes.com/section/science"
        case .tech: return "https://www.nytimes.com/section/technology"
        case .business: return "https://www.nytimes.com/section/business/smallbusiness"
        case .yourmoney: return "https://www.nytimes.com/section/your-money"
        case .education: return "https://www.nytimes.com/section/education?module=SiteIndex&pgtype=Section%20Front&region=Footer"
        case .sports: return "https://www.nytimes.com/section/sports/soccer"
        case .space: return "https://www.nytimes.com/section/science/space"
        }
    }
}


================================================
FILE: NYTimes/Model/Coredata model/CDArticle+CoreDataClass.swift
================================================
//
//  CDArticle+CoreDataClass.swift
//  NYTimes
//
//  Created by Waseem Akram on 01/08/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//
//

import Foundation
import CoreData

@objc(CDArticle)
public class CDArticle: NSManagedObject {

}


================================================
FILE: NYTimes/Model/Coredata model/CDArticle+CoreDataProperties.swift
================================================
//
//  CDArticle+CoreDataProperties.swift
//  NYTimes
//
//  Created by Waseem Akram on 01/08/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//
//

import Foundation
import CoreData


extension CDArticle {

    @nonobjc public class func fetchRequest() -> NSFetchRequest<CDArticle> {
        return NSFetchRequest<CDArticle>(entityName: "CDArticle")
    }

    @NSManaged public var author: String
    @NSManaged public var id: UUID
    @NSManaged public var imageUrl: String
    @NSManaged public var subtitle: String
    @NSManaged public var title: String
    @NSManaged public var url: String

    
    func set(from article: Article){
        author = article.author
        id = article.id
        imageUrl = article.imageUrl
        subtitle = article.subtitle
        title = article.title
        url = article.url
    }
    
}


================================================
FILE: NYTimes/Persistence/NYTimes.xcdatamodeld/.xccurrentversion
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>_XCCurrentVersionName</key>
	<string>NYTimes.xcdatamodel</string>
</dict>
</plist>


================================================
FILE: NYTimes/Persistence/NYTimes.xcdatamodeld/NYTimes.xcdatamodel/contents
================================================
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17162" systemVersion="19G46c" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
    <entity name="CDArticle" representedClassName="CDArticle" syncable="YES">
        <attribute name="author" attributeType="String"/>
        <attribute name="id" attributeType="UUID" usesScalarValueType="NO"/>
        <attribute name="imageUrl" attributeType="String"/>
        <attribute name="subtitle" attributeType="String"/>
        <attribute name="title" attributeType="String"/>
        <attribute name="url" attributeType="String"/>
        <uniquenessConstraints>
            <uniquenessConstraint>
                <constraint value="url"/>
            </uniquenessConstraint>
        </uniquenessConstraints>
    </entity>
    <elements>
        <element name="CDArticle" positionX="-63" positionY="-18" width="128" height="133"/>
    </elements>
</model>

================================================
FILE: NYTimes/Persistence/PersistenceManager.swift
================================================
//
//  PersistanceManager.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import CoreData

/// PersistenceManager is a Singleton which manages the
/// coredata core operations like creating containers, context and handles saving of the data
final class PersistenceManager {
    
    private init(){}
    
    static let shared = PersistenceManager()

    lazy var persistentContainer: NSPersistentContainer = {
        let container = NSPersistentContainer(name: "NYTimes")
        container.loadPersistentStores(completionHandler: { (storeDescription, error) in
            if let error = error as NSError? {
                fatalError("Unresolved error \(error), \(error.userInfo)")
            }
        })
        return container
    }()
    
    lazy var context = persistentContainer.viewContext

    func saveContext () -> Bool {
        let context = persistentContainer.viewContext
        if context.hasChanges {
            do {
                try context.save()
            } catch {
                let nserror = error as NSError
                debugPrint(nserror)
                return false
            }
            return true
        }
        return false
    }
    
    func fetch<T:NSManagedObject>(managedObject: T.Type) -> [T]? {
        do {
            guard let result = try PersistenceManager.shared.context.fetch(managedObject.fetchRequest()) as? [T] else {
                return nil
            }
            
            return result
        }catch let error {
            debugPrint(error)
            return nil
        }
    }
    
}


================================================
FILE: NYTimes/Preview Content/Preview Assets.xcassets/Contents.json
================================================
{
  "info" : {
    "author" : "xcode",
    "version" : 1
  }
}


================================================
FILE: NYTimes/Repository/BookmarkRepository.swift
================================================
//
//  BookmarkRepository.swift
//  NYTimes
//
//  Created by Waseem Akram on 31/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import CoreData


class BookmarkRepository {

    var context:NSManagedObjectContext!
    
    init(context:NSManagedObjectContext = PersistenceManager.shared.context){
        self.context = context
    }
    
    deinit {
        context = nil
    }
    
    func getAll() -> [CDArticle]? {
        guard let context = self.context else {return nil}
        let results:[CDArticle]? = try? context.fetch(CDArticle.fetchRequest())
        return results
    }
    
    func get(using URL:String)->CDArticle? {
        guard let context = self.context else {return nil}
        let fetchRequest:NSFetchRequest<CDArticle> = CDArticle.fetchRequest()
        fetchRequest.predicate = NSPredicate(format: "url == %@", URL)
        let results = try? context.fetch(fetchRequest)
        return results?.first
    }
    
    func isArticleExists(with URL:String) -> Bool {
        guard let context = self.context else {return false}
        do {
            let fetchRequest:NSFetchRequest<CDArticle> = CDArticle.fetchRequest()
            fetchRequest.predicate = NSPredicate(format: "url == %@", URL)
            let results = try context.fetch(fetchRequest)
            if results.first != nil {
                return true
            }
        }catch let error {
            debugPrint(error)
        }
        return false
    }
    
    func insert(article:Article,completion:((Bool)->Void)? = nil) {
        guard let context = self.context else {
            completion?(false)
            return
        }
        let cdArticle = CDArticle(context: context)
        cdArticle.set(from: article)
        insert(article: cdArticle) { (result) in
            completion?(result)
        }
    }
    
    func insert(article: CDArticle, completion:((Bool)->Void)? = nil) {
        guard let context = self.context else {
            completion?(false)
            return
        }
        
        do {
            if context.hasChanges {
                try context.save()
                completion?(true)
                return
            }
        }catch let error {
            debugPrint(error)
        }
        
        completion?(false)
    }

    func update(article: CDArticle,completion:((Bool)->Void)? = nil) {
        guard let context = self.context else {
            completion?(false)
            return
        }
        
        do {
            if context.hasChanges {
                try context.save()
                completion?(true)
                return
            }
        }catch let error {
            debugPrint(error)
        }
        
        completion?(false)
    }

    func delete(article: Article,completion: ((Bool)->Void)? = nil) {
        guard let context = self.context else {
            completion?(false)
            return
        }
        
        do {
            if let article = get(using: article.url) {
                context.delete(article)
                try context.save()
                completion?(true)
                return
            }
        }catch let error {
            debugPrint(error)
        }
        
        completion?(false)
    }
    
    func delete(article: CDArticle,completion: ((Bool)->Void)? = nil) {
        guard let context = self.context else {
            completion?(false)
            return
        }
        
        do {
            context.delete(article)
            try context.save()
            completion?(true)
            return
        }catch let error {
            debugPrint(error)
        }
        
        completion?(false)
    }

    func deleteAll() {
        guard let context = self.context else {return}
        do {
            let deleteRequest = NSBatchDeleteRequest(fetchRequest: CDArticle.fetchRequest())
            try context.execute(deleteRequest)
            try context.save()
        }catch let error {
         debugPrint(error)
        }
    }

}


================================================
FILE: NYTimes/Supporting files/AppDelegate.swift
================================================
//
//  AppDelegate.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import UIKit
import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    // MARK: UISceneSession Lifecycle

    func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
        // Called when a new scene session is being created.
        // Use this method to select a configuration to create the new scene with.
        return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
    }

    func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
        // Called when the user discards a scene session.
        // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
        // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
    }    

}



================================================
FILE: NYTimes/Supporting files/Base.lproj/LaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
    <dependencies>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="EHf-IW-A2E">
            <objects>
                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                    </view>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="53" y="375"/>
        </scene>
    </scenes>
</document>


================================================
FILE: NYTimes/Supporting files/SceneDelegate.swift
================================================
//
//  SceneDelegate.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import UIKit
import SwiftUI

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?


    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
        // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
        // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

        // Get the managed object context from the shared persistent container.
        let context = PersistenceManager.shared.context

        // Create the SwiftUI view and set the context as the value for the managedObjectContext environment keyPath.
        // Add `@Environment(\.managedObjectContext)` in the views that will need the context.
        let rootView = RootView().environment(\.managedObjectContext, context)

        // Use a UIHostingController as window root view controller.
        if let windowScene = scene as? UIWindowScene {
            let window = UIWindow(windowScene: windowScene)
            window.rootViewController = UIHostingController(rootView: rootView)
            self.window = window
            window.makeKeyAndVisible()
        }
    }

    func sceneDidDisconnect(_ scene: UIScene) {
        // Called as the scene is being released by the system.
        // This occurs shortly after the scene enters the background, or when its session is discarded.
        // Release any resources associated with this scene that can be re-created the next time the scene connects.
        // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
    }

    func sceneDidBecomeActive(_ scene: UIScene) {
        // Called when the scene has moved from an inactive state to an active state.
        // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
    }

    func sceneWillResignActive(_ scene: UIScene) {
        // Called when the scene will move from an active state to an inactive state.
        // This may occur due to temporary interruptions (ex. an incoming phone call).
    }

    func sceneWillEnterForeground(_ scene: UIScene) {
        // Called as the scene transitions from the background to the foreground.
        // Use this method to undo the changes made on entering the background.
    }

    func sceneDidEnterBackground(_ scene: UIScene) {
        // Called as the scene transitions from the foreground to the background.
        // Use this method to save data, release shared resources, and store enough scene-specific state information
        // to restore the scene back to its current state.

        // Save changes in the application's managed object context when the application transitions to the background.
        let _ = PersistenceManager.shared.saveContext()
    }


}



================================================
FILE: NYTimes/Utilities/Common Utils.swift
================================================
//
//  Utils.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import UIKit

// Phantom type placeholder for undefined methods
func undefined<T>(_ message:String="",file:String=#file,function:String=#function,line: Int=#line) -> T {
    fatalError("[File: \(file),Line: \(line),Function: \(function),]: Undefined: \(message)")
}


================================================
FILE: NYTimes/Utilities/HTMLScarperUtility.swift
================================================
//
//  HTMLScarpingUtility.swift
//  NYTimes
//
//  Created by Waseem Akram on 04/08/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import SwiftSoup
import Combine

class HTMLScraperUtility {
    
    func scrapArticle(from data:Data) -> Future<[Article], Never> {
        Future { promise in
            let html = String(data: data, encoding: .utf8)!
            var articles = [Article]()
            do {
                let elements = try SwiftSoup.parse(html, Constants.Endpoints.BASEURL)
                // last updated: 08-20-2023
                let documents = try elements.getElementById("stream-panel")?.select("div").select("ol").select("article")
                documents?.forEach({ (document) in
                    let imageUrl = try? document.select("img").attr("src")
                    let title = try? document.select("h3").text()
                    let subtitle = try? document.select("p").text()
                    let author = try? document.select("div").select("p").select("span").text()
                    let url = try? document.select("a").attr("href")
                    
                    if let title = title,
                       let subtitle = subtitle,
                       let author = author,
                       let url = url,
                       let imageUrl = imageUrl,
                       !title.isEmpty,
                       !subtitle.isEmpty,
                       !author.isEmpty,
                       !url.isEmpty,
                       !imageUrl.isEmpty {
                        
                        let article = Article(url: "https://www.nytimes.com\(url)", imageUrl: imageUrl, title: title, subtitle: subtitle, author: author)
                        articles.append(article)
                    } else {
                        print("parsing error")
                    }
                })
                promise(.success(articles))
            } catch let error {
                debugPrint(error)
                promise(.success([]))
                return
            }
        }
    }
}



================================================
FILE: NYTimes/Utilities/NetworkReachabilty.swift
================================================
//
//  NetworkReachabilty.swift
//  NYTimes
//
//  Created by Waseem Akram on 18/11/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import Combine
import Reachability

class NetworkReachabilty: ObservableObject {
    
    static let shared = NetworkReachabilty()
    
    private var cancellable: AnyCancellable?
    private var reachability = try? Reachability()
    
    @Published var isNetworkConnected = true
    
    private init(){
        guard let reachability = reachability else { return }
        cancellable = reachability.isReachable.assign(to: \.isNetworkConnected, on: self)
        do {
            try reachability.startNotifier()
        }catch {
            print("Could not start Reachability")
        }
    }
    
    private func dispose(){
        cancellable = nil
        reachability = nil
    }
    
    deinit {
        dispose()
    }
}



================================================
FILE: NYTimes/ViewModel/ArticleViewModel.swift
================================================
//
//  NewsFeedViewModel.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import Combine

class ArticleViewModel: ObservableObject {
    
    var htmlScrapUtlity = HTMLScraperUtility()
    
    @Published var articles = [Article]()
    @Published var isArticlesLoading = false
    
    var cancellableTask: AnyCancellable? = nil
    
    func loadArticles(for category: Category) {
        guard let url = URL(string: category.url) else { return }
        self.isArticlesLoading = true
        self.cancellableTask?.cancel() //cancel last subscription to prevent race condition
        self.cancellableTask = URLSession.shared.dataTaskPublisher(for: url)
            .map(\.data) //extract Data() from tuple
            .flatMap(htmlScrapUtlity.scrapArticle(from:)) //send data to scrap function that will return article objects (array)
            .sink { (completion) in
                self.isArticlesLoading = false //once we got articles, close the loader
            } receiveValue: { [unowned self] (articles) in
                self.articles = articles
            }
    }
    
    deinit {
        cancellableTask = nil
    }
}


================================================
FILE: NYTimes/ViewModel/BookmarkViewModel.swift
================================================
//
//  BookmarkViewModel.swift
//  NYTimes
//
//  Created by Waseem Akram on 31/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import Foundation
import Combine

class BookmarkViewModel:ObservableObject {
    
    var repository:BookmarkRepository!
    
    @Published var message = String()
    @Published var shouldShowAlert = false
    
    init(repository:BookmarkRepository) {
        self.repository = repository
    }
    
    init(){
        
    }
    
    func isArticleExists(with URL:String) -> Bool{
        return repository.isArticleExists(with: URL)
    }
    
    
    func bookmark(for article:Article){
        if isArticleExists(with: article.url) {
            handleExisitingArticle()
            return
        }
        
        repository.insert(article: article) { [weak self] (success) in
            guard let self = self else { return }
            self.showAlertForAddedBookmark(success: success)
        }
    }
    
    func bookmark(for article:CDArticle){
        
        if isArticleExists(with: article.url) {
            handleExisitingArticle()
            return
        }
        
        repository.insert(article: article) { [weak self] (success) in
            guard let self = self else { return }
            self.showAlertForAddedBookmark(success: success)
        }
    }
    
    func deleteBookmark(article:Article, showAlert: Bool = false){
        repository.delete(article: article) { [weak self] (success) in
            guard let self = self else { return }
            if showAlert {
                self.showAlertForDeletedBookmark(success: success)
            }
        }
    }
    
    func deleteBookmark(article:CDArticle, showAlert: Bool = false){
        repository.delete(article: article) { [weak self] (success) in
            guard let self = self else { return }
            if showAlert {
                self.showAlertForDeletedBookmark(success: success)
            }
        }
    }
        
    private func handleExisitingArticle() {
        self.shouldShowAlert = true
        self.message = "Bookmark exists already!"
    }
    
    private func showAlertForAddedBookmark(success:Bool){
        self.shouldShowAlert = true
        self.message = success ? "Added to Bookmarks" : "Error Bookmarking this article"
    }
    
    private func showAlertForDeletedBookmark(success:Bool){
        self.shouldShowAlert = true
        self.message = success ? "Removed from bookmarks" : "Error deleting this article from bookmarks"
    }
}


================================================
FILE: NYTimes/Views/BookmarksView.swift
================================================
//
//  BookmarksView.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import SwiftUI
import CoreData

struct BookmarksView: View {
    
    @Environment(\.managedObjectContext) var managedObjectContext
    
    @FetchRequest(entity: CDArticle.entity(), sortDescriptors: [], predicate: nil, animation: Animation.linear)
    var savedArticles:FetchedResults<CDArticle>
    
    @ObservedObject var bookmarkViewModel = BookmarkViewModel()
    
    @ViewBuilder
    var body: some View {
            List{
                ForEach(savedArticles,id:\.id) { savedArticle in
                    NavigationLink(destination: WebViewHolder(url: URL(string: savedArticle.url)!, article: Article(from: savedArticle))){
                        NewsFeedView(article: Article(from: savedArticle ))
                    }
                }
                .onDelete(perform: deleteBookmark(at:))
            }
            .listStyle(InsetGroupedListStyle())
            .navigationBarItems(trailing: EditButton())
            .navigationBarTitle("Bookmarks", displayMode: .automatic)
            .onAppear {
                self.bookmarkViewModel.repository = BookmarkRepository(context: self.managedObjectContext)
            }
    }
        
    func deleteBookmark(at offsets:IndexSet){
        for index in offsets {
            bookmarkViewModel.deleteBookmark(article: savedArticles[index])
        }
    }
}

struct BookmarksView_Previews: PreviewProvider {
    static var previews: some View {
        BookmarksView()
    }
}


================================================
FILE: NYTimes/Views/Categories/CategoriesView.swift
================================================
//
//  CategoriesView.swift
//  NYTimes
//
//  Created by Sameer Nawaz on 09/10/21.
//  Copyright © 2021 Waseem Akram. All rights reserved.
//

import SwiftUI

struct CategoriesView: View {

    @EnvironmentObject var viewModel: CategoriesViewModel

    var body: some View {
        List {
            Section {
                ForEach(viewModel.categories, id: \.rawValue) { category in
                    Text(category.rawValue)
                }.onMove(perform: viewModel.move)
                    .onDelete(perform: viewModel.delete)
            } header: {
                Text("My Categories")
            }
            
            Section {
                ForEach(viewModel.categoriesUnfollowed, id: \.self) { category in
                    HStack {
                        Text(category.rawValue)
                        Spacer()
                        Button {
                            viewModel.addCategory(category)
                        } label: {
                            Image(systemName: "plus.circle")
                        }

                    }
                }
            } header: {
                Text("Categories")
            }

        }
        .toolbar { EditButton() }
        .navigationBarTitle("Categories", displayMode: .automatic)
    }
}


================================================
FILE: NYTimes/Views/Categories/CategoriesViewModel.swift
================================================
//
//  CategoriesViewModel.swift
//  NYTimes
//
//  Created by Sameer Nawaz on 09/10/21.
//  Copyright © 2021 Waseem Akram. All rights reserved.
//

import Foundation

class CategoriesViewModel: ObservableObject {

    @Published private(set) var categories: [Category] = Category.allCases {
        didSet {
            saveCategories()
        }
    }
    
    @Published var selectedCategory: Category = Category.tech
    
    @Published var categoriesUnfollowed: [Category] = []

    init() {
        if let categories = UserDefaults.standard
            .array(forKey: Constants.UserDefaults.categories) as? [String] {
            self.categories = categories.map({ Category(rawValue: $0)! })
            updateUnfollowedCategories()
            selectedCategory = self.categories[0]
        }
    }
    
    func updateUnfollowedCategories() {
        for category in Category.allCases {
            if !categories.contains(where: {$0.rawValue == category.rawValue}) {
                categoriesUnfollowed.append(category)
            }
        }
    }
    
    func addCategory(_ category: Category) {
        categoriesUnfollowed = categoriesUnfollowed.filter {$0.rawValue != category.rawValue}
        categories.append(category)
    }
    
    func delete(at offsets: IndexSet) {
        guard let index = offsets.first else { return }
        categoriesUnfollowed.append(categories[index])
        categories.remove(atOffsets: offsets)
    }

    func move(from source: IndexSet, to destination: Int) {
        categories.move(fromOffsets: source, toOffset: destination)
    }

    private func saveCategories() {
        let categories = categories.map({ $0.rawValue })
        UserDefaults.standard.set(categories, forKey: Constants.UserDefaults.categories)
    }
}


================================================
FILE: NYTimes/Views/CategorySelector.swift
================================================
//
//  CategorySelector.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import SwiftUI

struct CategorySelector: View {
    
    @EnvironmentObject var categoriesViewModel: CategoriesViewModel
    @EnvironmentObject var articleViewModel: ArticleViewModel

    
    var body: some View {
            ScrollView(.horizontal, showsIndicators: false) {
                HStack {
                    ForEach(categoriesViewModel.categories, id: \.rawValue) { category in
                        VStack{
                            Spacer()
                            HStack {
                                Text(category.rawValue)
                                    .foregroundColor(categoriesViewModel.selectedCategory == category ? .white : .init(UIColor.label))
                                    .fontWeight(.medium)
                            }
                            .padding(.leading,16)
                            .padding(.trailing,16)
                            Spacer()
                        }
                        .background(categoriesViewModel.selectedCategory == category ? Color.purple : Color("categoryBackground"))
                            .cornerRadius(10)
                            .onTapGesture {
                                categoriesViewModel.selectedCategory = category
                                articleViewModel.loadArticles(for: category)
                        }
                    }.padding(.leading,8)
                }
            }
            .padding(.vertical,24)
            .background(Color.init(.secondarySystemBackground))
            .clipped()
            .shadow(radius: 15)
    }
        
}



struct CategorySelector_Previews: PreviewProvider {
    static var previews: some View {
        CategorySelector()
            .environmentObject(ArticleViewModel())
            .environmentObject(CategoriesViewModel())
            .previewDevice(.init("iPhone X"))
            
    }
}




================================================
FILE: NYTimes/Views/NewsFeedView.swift
================================================
//
//  NewsFeedView.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import SwiftUI
import KingfisherSwiftUI

struct NewsFeedView: View {
    
    var article:Article
    
    var body: some View {
        HStack {
            KFImage(URL(string: article.imageUrl)!)
                .placeholder({
                    ProgressView()
                })
                .resizable()
                .scaledToFill()
                .frame(width: 100, height: 120)
                .clipped()
                .cornerRadius(12)
            
            
            VStack(alignment: .leading, spacing: 8) {
                Text(article.title)
                    
                    .font(.headline)
                    .lineLimit(2)
                
                Text(article.subtitle)
                    .font(.subheadline)
                    .opacity(0.7)
                    .lineLimit(2)
                
                Text(article.author)
                    .font(.system(size: 13, weight: .medium, design: .rounded))
                    .multilineTextAlignment(.leading)
            }.padding(.horizontal, 12)
        }
        .padding(12)
    }
}

struct NewsFeedView_Previews: PreviewProvider {
    static var previews: some View {
        NewsFeedView(article: Article(
            url: "https://static01.nyt.com/images/2020/07/28/science/28SCI-MARS-JEZERO1/28SCI-MARS-JEZERO1-jumbo.jpg",
            imageUrl: "https://static01.nyt.com/images/2020/07/28/science/28SCI-MARS-JEZERO1/28SCI-MARS-JEZERO1-jumbo.jpg",
            title: "How NASA Found the Ideal Hole on Mars to Land In",
            subtitle: "Jezero crater, the destination of the Perseverance rover, is a promising place to look for evidence of extinct Martian life.",
            author: "KENNETH CHANG"
        ))
        //            .previewDevice(.init(stringLiteral: "iPhone X"))
        //            .edgesIgnoringSafeArea(.all)
        //            .environment(\.colorScheme, .dark)
    }
}


================================================
FILE: NYTimes/Views/RootView.swift
================================================
//
//  ContentView.swift
//  NYTimes
//
//  Created by Waseem Akram on 28/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import SwiftUI
import CoreData

struct RootView: View {
    
    @Environment(\.managedObjectContext) var managedObjectContext
    
    @ObservedObject var articlesViewModel = ArticleViewModel()
    @ObservedObject var bookmarkViewModel = BookmarkViewModel()
    @ObservedObject var networkReachability = NetworkReachabilty.shared
    @ObservedObject var categoriesViewModel = CategoriesViewModel()

    @State var shouldShowBookmarks = false
    @State var openCategories = false
    @State var isLoaded = false

    init() {
        articlesViewModel.loadArticles(for: categoriesViewModel.selectedCategory)
    }
    
    var body: some View {
        NavigationView {
            if networkReachability.isNetworkConnected {
                ArticleView()
                    .edgesIgnoringSafeArea(.bottom)
                    .navigationViewStyle(StackNavigationViewStyle())
                    .navigationBarTitle(Text("NYTimes"))
                    .navigationBarItems(
                        leading: categoriesView,
                        trailing: bookmarksView
                    )
            } else {
                VStack {
                    Image(systemName: "wifi.slash")
                        .font(.system(size: 50))
                        .frame(width: 50, height: 50, alignment: .center)
                        .padding(.bottom, 24)
                    Text("Network not available")
                        .alert(isPresented: .constant(true)) {
                            Alert(title: Text("Network not available"), message: Text("Turn on mobile data or use Wi-Fi to access data"), dismissButton: .default(Text("OK")))
                        }.navigationBarTitle(Text("NYTimes"))
                }
            }
        }.onAppear {
            let repo = BookmarkRepository(context: managedObjectContext)
            bookmarkViewModel.repository = repo
            DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(650)) {
                isLoaded = true
            }
            articlesViewModel.loadArticles(for: categoriesViewModel.selectedCategory)
        }
    }

    private var categoriesView: some View {
        Button(action: { openCategories = true }, label: {
            Image(systemName: "square.stack.3d.up")
                .frame(width: 30, height: 50, alignment: .center)
        })
    }

    private var bookmarksView: some View {
        Button(action: { shouldShowBookmarks = true }, label: {
            Image(systemName: "folder")
                .frame(width: 30, height: 50, alignment: .center)
        })
    }
    
    fileprivate func ArticleView() -> some View {
        return VStack {
            NavigationLink(destination: BookmarksView(), isActive: $shouldShowBookmarks) {}
            NavigationLink(destination: CategoriesView().environmentObject(categoriesViewModel), isActive: $openCategories) {}
            if articlesViewModel.isArticlesLoading {
                VStack{
                    Spacer()
                    ForEach(0..<3) { i in
                        NewsFeedView(article: .placeholder)
                    }.redacted(reason: .placeholder)
                    Spacer()
                }
            } else {
                ArticleListView(articlesViewModel: articlesViewModel, bookmarkViewModel: bookmarkViewModel)
            }
            Spacer()
            CategorySelector()
                .environmentObject(articlesViewModel)
                .environmentObject(categoriesViewModel)
                .frame(height: 100).offset(y: isLoaded ? 0 : 100)
                .animation(isLoaded ? .spring() : .none)
        }
    }
}


struct ArticleListView: View {
    
    @ObservedObject var articlesViewModel: ArticleViewModel
    @ObservedObject var bookmarkViewModel: BookmarkViewModel
    
    var body: some View {
        List(articlesViewModel.articles, id: \.id){ article in
            NavigationLink(destination: WebViewHolder(url: URL(string: article.url)!, article: article)){
                NewsFeedView(article: article)
                    .contextMenu(menuItems: {
                        Button(action: {
                            bookmarkViewModel.bookmark(for: article)
                        }) {
                            Text("Bookmark")
                            Image(uiImage:UIImage(systemName:"bookmark")!)
                        }
                        .alert(isPresented: $bookmarkViewModel.shouldShowAlert) {
                            return Alert(
                                title: Text(bookmarkViewModel.message),
                                dismissButton: .default(Text("OK"))
                            )
                        }
                    })
            }
        }
        .listStyle(InsetGroupedListStyle())
        .padding(.bottom, -8)
    }
}


struct RootView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            RootView()
                .previewDevice(.init(stringLiteral: "iPhone 11"))
        }
    }
}


================================================
FILE: NYTimes/Views/WebView.swift
================================================
//
//  WebView.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//


import UIKit
import SwiftUI
import WebKit

struct WebView: UIViewControllerRepresentable {
    let url: URL

    func makeUIViewController(context: Context) -> WebviewController {
        return WebviewController()
    }

    func updateUIViewController(_ webviewController: WebviewController, context: Context) {
        var request = URLRequest(url: self.url, cachePolicy: .returnCacheDataElseLoad)
        request.httpShouldHandleCookies = false
        webviewController.webview.load(request)
    }
}

class WebviewController: UIViewController {
    lazy var webview: WKWebView = WKWebView()
    lazy var progressbar: UIProgressView = UIProgressView()

    override func viewDidLoad() {
        super.viewDidLoad()

        self.webview.frame = self.view.frame
        self.view.addSubview(self.webview)

        self.view.addSubview(self.progressbar)
        self.progressbar.translatesAutoresizingMaskIntoConstraints = false
        self.view.addConstraints([
            self.progressbar.topAnchor.constraint(equalTo: self.view.topAnchor),
            self.progressbar.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
            self.progressbar.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
        ])

        self.progressbar.progress = 0.1
        webview.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
    }

    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
        switch keyPath {
        case "estimatedProgress":
            if self.webview.estimatedProgress >= 1.0 {
                UIView.animate(withDuration: 0.3, animations: { () in
                    self.progressbar.alpha = 0.0
                }, completion: { finished in
                    self.progressbar.setProgress(0.0, animated: false)
                })
            } else {
                self.progressbar.isHidden = false
                self.progressbar.alpha = 1.0
                progressbar.setProgress(Float(self.webview.estimatedProgress), animated: true)
            }
        default:
            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
        }
    }
}




================================================
FILE: NYTimes/Views/WebViewHolder.swift
================================================
//
//  WebViewHolder.swift
//  NYTimes
//
//  Created by Waseem Akram on 29/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import SwiftUI
import CoreData

struct WebViewHolder: View {
    
    var url:URL
    var article:Article
    
    @State var isBookmarked = false
    
    @Environment(\.managedObjectContext) var managedObjectContext
    
    @ObservedObject var bookmarkViewModel = BookmarkViewModel(repository: BookmarkRepository())
    
    var body: some View {
        WebView(url: url)
        .navigationBarItems(trailing: Button(action: {
            self.isBookmarked ? bookmarkViewModel.deleteBookmark(article: article,showAlert: true) : bookmarkViewModel.bookmark(for: article)
            self.isBookmarked = bookmarkViewModel.isArticleExists(with: article.url)
        }, label: {
            Image(systemName: "bookmark\(isBookmarked ? ".fill" : "")").frame(width: 30, height: 50,alignment: .center)
        }).alert(isPresented: $bookmarkViewModel.shouldShowAlert) {
            Alert(
                title: Text(bookmarkViewModel.message),
                dismissButton: .default(Text("OK"))
            )
        })
        .onAppear {
            self.isBookmarked = bookmarkViewModel.isArticleExists(with: article.url)
        }
    }
}

struct WebViewHolder_Previews: PreviewProvider {
    static var previews: some View {
        WebViewHolder(url:URL(string: "https://google.com")!, article: PlaceHolderData.articles[0])
            .previewDevice(.init(stringLiteral: "iPhone X"))
    }
}


================================================
FILE: NYTimes.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 52;
	objects = {

/* Begin PBXBuildFile section */
		732DDA5E27125B650006F018 /* CategoriesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 732DDA5D27125B650006F018 /* CategoriesView.swift */; };
		732DDA6027125B6D0006F018 /* CategoriesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 732DDA5F27125B6D0006F018 /* CategoriesViewModel.swift */; };
		75117C2024D4294D0097E28F /* BookmarkRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75117C1F24D4294D0097E28F /* BookmarkRepository.swift */; };
		75117C2424D43CE90097E28F /* BookmarkViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75117C2324D43CE90097E28F /* BookmarkViewModel.swift */; };
		7524922624D053CE00B1ACA5 /* NewsFeedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7524922524D053CE00B1ACA5 /* NewsFeedView.swift */; };
		7533BB3724D9E00C00A4AF49 /* HTMLScarperUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7533BB3624D9E00C00A4AF49 /* HTMLScarperUtility.swift */; };
		754C9A1D24D1500C00706469 /* Article.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754C9A1C24D1500C00706469 /* Article.swift */; };
		754FAFE724D0308900ACFE9E /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754FAFE624D0308900ACFE9E /* Category.swift */; };
		7552547224D5E2E700E2143D /* CDArticle+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7552547024D5E2E700E2143D /* CDArticle+CoreDataClass.swift */; };
		7552547324D5E2E700E2143D /* CDArticle+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7552547124D5E2E700E2143D /* CDArticle+CoreDataProperties.swift */; };
		7557FA7B24D0271400F80607 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7557FA7A24D0271400F80607 /* AppDelegate.swift */; };
		7557FA7D24D0271400F80607 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7557FA7C24D0271400F80607 /* SceneDelegate.swift */; };
		7557FA8024D0271400F80607 /* NYTimes.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 7557FA7E24D0271400F80607 /* NYTimes.xcdatamodeld */; };
		7557FA8224D0271400F80607 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7557FA8124D0271400F80607 /* RootView.swift */; };
		7557FA8424D0271500F80607 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7557FA8324D0271500F80607 /* Assets.xcassets */; };
		7557FA8724D0271500F80607 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7557FA8624D0271500F80607 /* Preview Assets.xcassets */; };
		7557FA8A24D0271500F80607 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7557FA8824D0271500F80607 /* LaunchScreen.storyboard */; };
		7557FAA024D0277200F80607 /* CategorySelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7557FA9F24D0277200F80607 /* CategorySelector.swift */; };
		757C5E8724D1B5680024C2AE /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757C5E8624D1B5680024C2AE /* WebView.swift */; };
		757C5E8B24D1C9A20024C2AE /* WebViewHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757C5E8A24D1C9A20024C2AE /* WebViewHolder.swift */; };
		757C5E8F24D1DFCE0024C2AE /* Common Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757C5E8E24D1DFCD0024C2AE /* Common Utils.swift */; };
		75BDFDC324D3F2100041AD20 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BDFDC224D3F2100041AD20 /* Constants.swift */; };
		75C2757F24D0A5E500A7A651 /* BookmarksView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C2757E24D0A5E500A7A651 /* BookmarksView.swift */; };
		75C2758324D0AC2C00A7A651 /* ArticleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C2758224D0AC2C00A7A651 /* ArticleViewModel.swift */; };
		75C2758824D0AEBC00A7A651 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = 75C2758724D0AEBC00A7A651 /* SwiftSoup */; };
		75C2759B24D0BA6B00A7A651 /* Bookmark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C2759A24D0BA6B00A7A651 /* Bookmark.swift */; };
		75C2759D24D0BB6C00A7A651 /* PersistenceManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C2759C24D0BB6C00A7A651 /* PersistenceManager.swift */; };
		75D4FB5325653D7F0095AC82 /* Reachability in Frameworks */ = {isa = PBXBuildFile; productRef = 75D4FB5225653D7F0095AC82 /* Reachability */; };
		75D4FB5725653DC30095AC82 /* Reachability + Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D4FB5625653DC30095AC82 /* Reachability + Extensions.swift */; };
		75D4FB5B256542B00095AC82 /* NetworkReachabilty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D4FB5A256542B00095AC82 /* NetworkReachabilty.swift */; };
		75DDE51824D4097400F9F165 /* NYTimesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75DDE51724D4097400F9F165 /* NYTimesTests.swift */; };
		75DDE51C24D40DDD00F9F165 /* ArticleRepositoryTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75DDE51B24D40DDD00F9F165 /* ArticleRepositoryTest.swift */; };
		75F6869924D19C5C003E0E4A /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 75F6869824D19C5C003E0E4A /* Kingfisher */; };
		75F6869B24D19C5C003E0E4A /* KingfisherSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = 75F6869A24D19C5C003E0E4A /* KingfisherSwiftUI */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
		75DDE51224D4094F00F9F165 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 7557FA6F24D0271400F80607 /* Project object */;
			proxyType = 1;
			remoteGlobalIDString = 7557FA7624D0271400F80607;
			remoteInfo = NYTimes;
		};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
		75E694BC24D1988C00D4C04C /* Embed Frameworks */ = {
			isa = PBXCopyFilesBuildPhase;
			buildActionMask = 2147483647;
			dstPath = "";
			dstSubfolderSpec = 10;
			files = (
			);
			name = "Embed Frameworks";
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
		732DDA5D27125B650006F018 /* CategoriesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoriesView.swift; sourceTree = "<group>"; };
		732DDA5F27125B6D0006F018 /* CategoriesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoriesViewModel.swift; sourceTree = "<group>"; };
		75117C1F24D4294D0097E28F /* BookmarkRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkRepository.swift; sourceTree = "<group>"; };
		75117C2324D43CE90097E28F /* BookmarkViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkViewModel.swift; sourceTree = "<group>"; };
		7524922524D053CE00B1ACA5 /* NewsFeedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewsFeedView.swift; sourceTree = "<group>"; };
		7533BB3624D9E00C00A4AF49 /* HTMLScarperUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLScarperUtility.swift; sourceTree = "<group>"; };
		754C9A1C24D1500C00706469 /* Article.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Article.swift; sourceTree = "<group>"; };
		754FAFE624D0308900ACFE9E /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = "<group>"; };
		7552547024D5E2E700E2143D /* CDArticle+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDArticle+CoreDataClass.swift"; sourceTree = "<group>"; };
		7552547124D5E2E700E2143D /* CDArticle+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CDArticle+CoreDataProperties.swift"; sourceTree = "<group>"; };
		7557FA7724D0271400F80607 /* NYTimes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NYTimes.app; sourceTree = BUILT_PRODUCTS_DIR; };
		7557FA7A24D0271400F80607 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
		7557FA7C24D0271400F80607 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
		7557FA7F24D0271400F80607 /* NYTimes.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = NYTimes.xcdatamodel; sourceTree = "<group>"; };
		7557FA8124D0271400F80607 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
		7557FA8324D0271500F80607 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
		7557FA8624D0271500F80607 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
		7557FA8924D0271500F80607 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
		7557FA8B24D0271500F80607 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		7557FA9F24D0277200F80607 /* CategorySelector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategorySelector.swift; sourceTree = "<group>"; };
		757C5E8624D1B5680024C2AE /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
		757C5E8A24D1C9A20024C2AE /* WebViewHolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewHolder.swift; sourceTree = "<group>"; };
		757C5E8E24D1DFCD0024C2AE /* Common Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Common Utils.swift"; sourceTree = "<group>"; };
		75BDFDC224D3F2100041AD20 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
		75C2757E24D0A5E500A7A651 /* BookmarksView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksView.swift; sourceTree = "<group>"; };
		75C2758224D0AC2C00A7A651 /* ArticleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleViewModel.swift; sourceTree = "<group>"; };
		75C2759A24D0BA6B00A7A651 /* Bookmark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bookmark.swift; sourceTree = "<group>"; };
		75C2759C24D0BB6C00A7A651 /* PersistenceManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceManager.swift; sourceTree = "<group>"; };
		75D4FB5625653DC30095AC82 /* Reachability + Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Reachability + Extensions.swift"; sourceTree = "<group>"; };
		75D4FB5A256542B00095AC82 /* NetworkReachabilty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkReachabilty.swift; sourceTree = "<group>"; };
		75DDE50D24D4094F00F9F165 /* NYTimesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NYTimesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
		75DDE51724D4097400F9F165 /* NYTimesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NYTimesTests.swift; sourceTree = "<group>"; };
		75DDE51924D4098600F9F165 /* NYTimesTestInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = NYTimesTestInfo.plist; sourceTree = "<group>"; };
		75DDE51B24D40DDD00F9F165 /* ArticleRepositoryTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleRepositoryTest.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		7557FA7424D0271400F80607 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
				75F6869B24D19C5C003E0E4A /* KingfisherSwiftUI in Frameworks */,
				75D4FB5325653D7F0095AC82 /* Reachability in Frameworks */,
				75F6869924D19C5C003E0E4A /* Kingfisher in Frameworks */,
				75C2758824D0AEBC00A7A651 /* SwiftSoup in Frameworks */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		75DDE50A24D4094F00F9F165 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		732DDA5C27125B4F0006F018 /* Categories */ = {
			isa = PBXGroup;
			children = (
				732DDA5D27125B650006F018 /* CategoriesView.swift */,
				732DDA5F27125B6D0006F018 /* CategoriesViewModel.swift */,
			);
			path = Categories;
			sourceTree = "<group>";
		};
		7533BB3324D9DFE200A4AF49 /* Utilities */ = {
			isa = PBXGroup;
			children = (
				757C5E8E24D1DFCD0024C2AE /* Common Utils.swift */,
				7533BB3624D9E00C00A4AF49 /* HTMLScarperUtility.swift */,
				75D4FB5A256542B00095AC82 /* NetworkReachabilty.swift */,
			);
			path = Utilities;
			sourceTree = "<group>";
		};
		7557FA6E24D0271400F80607 = {
			isa = PBXGroup;
			children = (
				7557FA7924D0271400F80607 /* NYTimes */,
				75DDE50E24D4094F00F9F165 /* NYTimesTests */,
				7557FA7824D0271400F80607 /* Products */,
			);
			sourceTree = "<group>";
		};
		7557FA7824D0271400F80607 /* Products */ = {
			isa = PBXGroup;
			children = (
				7557FA7724D0271400F80607 /* NYTimes.app */,
				75DDE50D24D4094F00F9F165 /* NYTimesTests.xctest */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		7557FA7924D0271400F80607 /* NYTimes */ = {
			isa = PBXGroup;
			children = (
				75D4FB5525653DB40095AC82 /* Extensions */,
				7533BB3324D9DFE200A4AF49 /* Utilities */,
				757C5E9024D1DFDA0024C2AE /* Globals */,
				7557FAA324D0293900F80607 /* Persistence */,
				7557FAA424D0294B00F80607 /* Views */,
				75C2759E24D0BBCC00A7A651 /* Repository */,
				7557FAA224D0292F00F80607 /* ViewModel */,
				7557FAA124D0292600F80607 /* Model */,
				7557FAA524D0295B00F80607 /* Supporting files */,
				7557FA8324D0271500F80607 /* Assets.xcassets */,
				7557FA8B24D0271500F80607 /* Info.plist */,
				7557FA8524D0271500F80607 /* Preview Content */,
			);
			path = NYTimes;
			sourceTree = "<group>";
		};
		7557FA8524D0271500F80607 /* Preview Content */ = {
			isa = PBXGroup;
			children = (
				7557FA8624D0271500F80607 /* Preview Assets.xcassets */,
			);
			path = "Preview Content";
			sourceTree = "<group>";
		};
		7557FAA124D0292600F80607 /* Model */ = {
			isa = PBXGroup;
			children = (
				75C2759324D0B3D900A7A651 /* Coredata model */,
				754FAFE624D0308900ACFE9E /* Category.swift */,
				75C2759A24D0BA6B00A7A651 /* Bookmark.swift */,
				754C9A1C24D1500C00706469 /* Article.swift */,
			);
			path = Model;
			sourceTree = "<group>";
		};
		7557FAA224D0292F00F80607 /* ViewModel */ = {
			isa = PBXGroup;
			children = (
				75C2758224D0AC2C00A7A651 /* ArticleViewModel.swift */,
				75117C2324D43CE90097E28F /* BookmarkViewModel.swift */,
			);
			path = ViewModel;
			sourceTree = "<group>";
		};
		7557FAA324D0293900F80607 /* Persistence */ = {
			isa = PBXGroup;
			children = (
				7557FA7E24D0271400F80607 /* NYTimes.xcdatamodeld */,
				75C2759C24D0BB6C00A7A651 /* PersistenceManager.swift */,
			);
			path = Persistence;
			sourceTree = "<group>";
		};
		7557FAA424D0294B00F80607 /* Views */ = {
			isa = PBXGroup;
			children = (
				732DDA5C27125B4F0006F018 /* Categories */,
				7557FA8124D0271400F80607 /* RootView.swift */,
				7557FA9F24D0277200F80607 /* CategorySelector.swift */,
				7524922524D053CE00B1ACA5 /* NewsFeedView.swift */,
				75C2757E24D0A5E500A7A651 /* BookmarksView.swift */,
				757C5E8624D1B5680024C2AE /* WebView.swift */,
				757C5E8A24D1C9A20024C2AE /* WebViewHolder.swift */,
			);
			path = Views;
			sourceTree = "<group>";
		};
		7557FAA524D0295B00F80607 /* Supporting files */ = {
			isa = PBXGroup;
			children = (
				7557FA8824D0271500F80607 /* LaunchScreen.storyboard */,
				7557FA7A24D0271400F80607 /* AppDelegate.swift */,
				7557FA7C24D0271400F80607 /* SceneDelegate.swift */,
			);
			path = "Supporting files";
			sourceTree = "<group>";
		};
		757C5E9024D1DFDA0024C2AE /* Globals */ = {
			isa = PBXGroup;
			children = (
				75BDFDC224D3F2100041AD20 /* Constants.swift */,
			);
			path = Globals;
			sourceTree = "<group>";
		};
		75C2759324D0B3D900A7A651 /* Coredata model */ = {
			isa = PBXGroup;
			children = (
				7552547024D5E2E700E2143D /* CDArticle+CoreDataClass.swift */,
				7552547124D5E2E700E2143D /* CDArticle+CoreDataProperties.swift */,
			);
			path = "Coredata model";
			sourceTree = "<group>";
		};
		75C2759E24D0BBCC00A7A651 /* Repository */ = {
			isa = PBXGroup;
			children = (
				75117C1F24D4294D0097E28F /* BookmarkRepository.swift */,
			);
			path = Repository;
			sourceTree = "<group>";
		};
		75D4FB5525653DB40095AC82 /* Extensions */ = {
			isa = PBXGroup;
			children = (
				75D4FB5625653DC30095AC82 /* Reachability + Extensions.swift */,
			);
			path = Extensions;
			sourceTree = "<group>";
		};
		75DDE50E24D4094F00F9F165 /* NYTimesTests */ = {
			isa = PBXGroup;
			children = (
				75DDE51924D4098600F9F165 /* NYTimesTestInfo.plist */,
				75DDE51724D4097400F9F165 /* NYTimesTests.swift */,
				75DDE51B24D40DDD00F9F165 /* ArticleRepositoryTest.swift */,
			);
			path = NYTimesTests;
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		7557FA7624D0271400F80607 /* NYTimes */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 7557FA9924D0271500F80607 /* Build configuration list for PBXNativeTarget "NYTimes" */;
			buildPhases = (
				7557FA7324D0271400F80607 /* Sources */,
				7557FA7424D0271400F80607 /* Frameworks */,
				7557FA7524D0271400F80607 /* Resources */,
				75E694BC24D1988C00D4C04C /* Embed Frameworks */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = NYTimes;
			packageProductDependencies = (
				75C2758724D0AEBC00A7A651 /* SwiftSoup */,
				75F6869824D19C5C003E0E4A /* Kingfisher */,
				75F6869A24D19C5C003E0E4A /* KingfisherSwiftUI */,
				75D4FB5225653D7F0095AC82 /* Reachability */,
			);
			productName = NYTimes;
			productReference = 7557FA7724D0271400F80607 /* NYTimes.app */;
			productType = "com.apple.product-type.application";
		};
		75DDE50C24D4094F00F9F165 /* NYTimesTests */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = 75DDE51424D4094F00F9F165 /* Build configuration list for PBXNativeTarget "NYTimesTests" */;
			buildPhases = (
				75DDE50924D4094F00F9F165 /* Sources */,
				75DDE50A24D4094F00F9F165 /* Frameworks */,
				75DDE50B24D4094F00F9F165 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
				75DDE51324D4094F00F9F165 /* PBXTargetDependency */,
			);
			name = NYTimesTests;
			productName = NYTimesTests;
			productReference = 75DDE50D24D4094F00F9F165 /* NYTimesTests.xctest */;
			productType = "com.apple.product-type.bundle.unit-test";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		7557FA6F24D0271400F80607 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastSwiftUpdateCheck = 1200;
				LastUpgradeCheck = 1200;
				ORGANIZATIONNAME = "Waseem Akram";
				TargetAttributes = {
					7557FA7624D0271400F80607 = {
						CreatedOnToolsVersion = 11.5;
					};
					75DDE50C24D4094F00F9F165 = {
						CreatedOnToolsVersion = 12.0;
						TestTargetID = 7557FA7624D0271400F80607;
					};
				};
			};
			buildConfigurationList = 7557FA7224D0271400F80607 /* Build configuration list for PBXProject "NYTimes" */;
			compatibilityVersion = "Xcode 9.3";
			developmentRegion = en;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = 7557FA6E24D0271400F80607;
			packageReferences = (
				75C2758624D0AEBC00A7A651 /* XCRemoteSwiftPackageReference "SwiftSoup" */,
				75F6869724D19C5C003E0E4A /* XCRemoteSwiftPackageReference "Kingfisher" */,
				75D4FB5125653D7F0095AC82 /* XCRemoteSwiftPackageReference "Reachability" */,
			);
			productRefGroup = 7557FA7824D0271400F80607 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				7557FA7624D0271400F80607 /* NYTimes */,
				75DDE50C24D4094F00F9F165 /* NYTimesTests */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		7557FA7524D0271400F80607 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				7557FA8A24D0271500F80607 /* LaunchScreen.storyboard in Resources */,
				7557FA8724D0271500F80607 /* Preview Assets.xcassets in Resources */,
				7557FA8424D0271500F80607 /* Assets.xcassets in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		75DDE50B24D4094F00F9F165 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		7557FA7324D0271400F80607 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				7557FA8024D0271400F80607 /* NYTimes.xcdatamodeld in Sources */,
				757C5E8724D1B5680024C2AE /* WebView.swift in Sources */,
				754C9A1D24D1500C00706469 /* Article.swift in Sources */,
				75117C2424D43CE90097E28F /* BookmarkViewModel.swift in Sources */,
				7557FA7B24D0271400F80607 /* AppDelegate.swift in Sources */,
				732DDA5E27125B650006F018 /* CategoriesView.swift in Sources */,
				75C2758324D0AC2C00A7A651 /* ArticleViewModel.swift in Sources */,
				75C2759B24D0BA6B00A7A651 /* Bookmark.swift in Sources */,
				75D4FB5B256542B00095AC82 /* NetworkReachabilty.swift in Sources */,
				75C2757F24D0A5E500A7A651 /* BookmarksView.swift in Sources */,
				7557FA8224D0271400F80607 /* RootView.swift in Sources */,
				7557FAA024D0277200F80607 /* CategorySelector.swift in Sources */,
				75D4FB5725653DC30095AC82 /* Reachability + Extensions.swift in Sources */,
				7524922624D053CE00B1ACA5 /* NewsFeedView.swift in Sources */,
				75BDFDC324D3F2100041AD20 /* Constants.swift in Sources */,
				7557FA7D24D0271400F80607 /* SceneDelegate.swift in Sources */,
				757C5E8F24D1DFCE0024C2AE /* Common Utils.swift in Sources */,
				75117C2024D4294D0097E28F /* BookmarkRepository.swift in Sources */,
				7552547224D5E2E700E2143D /* CDArticle+CoreDataClass.swift in Sources */,
				757C5E8B24D1C9A20024C2AE /* WebViewHolder.swift in Sources */,
				7552547324D5E2E700E2143D /* CDArticle+CoreDataProperties.swift in Sources */,
				754FAFE724D0308900ACFE9E /* Category.swift in Sources */,
				75C2759D24D0BB6C00A7A651 /* PersistenceManager.swift in Sources */,
				732DDA6027125B6D0006F018 /* CategoriesViewModel.swift in Sources */,
				7533BB3724D9E00C00A4AF49 /* HTMLScarperUtility.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
		75DDE50924D4094F00F9F165 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				75DDE51C24D40DDD00F9F165 /* ArticleRepositoryTest.swift in Sources */,
				75DDE51824D4097400F9F165 /* NYTimesTests.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
		75DDE51324D4094F00F9F165 /* PBXTargetDependency */ = {
			isa = PBXTargetDependency;
			target = 7557FA7624D0271400F80607 /* NYTimes */;
			targetProxy = 75DDE51224D4094F00F9F165 /* PBXContainerItemProxy */;
		};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
		7557FA8824D0271500F80607 /* LaunchScreen.storyboard */ = {
			isa = PBXVariantGroup;
			children = (
				7557FA8924D0271500F80607 /* Base */,
			);
			name = LaunchScreen.storyboard;
			sourceTree = "<group>";
		};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
		7557FA9724D0271500F80607 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_ENABLE_OBJC_WEAK = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = dwarf;
				DISABLE_DIAMOND_PROBLEM_DIAGNOSTIC = 1;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				ENABLE_TESTABILITY = YES;
				GCC_C_LANGUAGE_STANDARD = gnu11;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
				MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
				MTL_FAST_MATH = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = iphoneos;
				SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
			};
			name = Debug;
		};
		7557FA9824D0271500F80607 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_ANALYZER_NONNULL = YES;
				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_ENABLE_OBJC_WEAK = YES;
				CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
				CLANG_WARN_BOOL_CONVERSION = YES;
				CLANG_WARN_COMMA = YES;
				CLANG_WARN_CONSTANT_CONVERSION = YES;
				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
				CLANG_WARN_EMPTY_BODY = YES;
				CLANG_WARN_ENUM_CONVERSION = YES;
				CLANG_WARN_INFINITE_RECURSION = YES;
				CLANG_WARN_INT_CONVERSION = YES;
				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
				CLANG_WARN_STRICT_PROTOTYPES = YES;
				CLANG_WARN_SUSPICIOUS_MOVE = YES;
				CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
				CLANG_WARN_UNREACHABLE_CODE = YES;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				COPY_PHASE_STRIP = NO;
				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
				DISABLE_DIAMOND_PROBLEM_DIAGNOSTIC = 1;
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu11;
				GCC_NO_COMMON_BLOCKS = YES;
				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				GCC_WARN_UNUSED_FUNCTION = YES;
				GCC_WARN_UNUSED_VARIABLE = YES;
				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
				MTL_ENABLE_DEBUG_INFO = NO;
				MTL_FAST_MATH = YES;
				SDKROOT = iphoneos;
				SWIFT_COMPILATION_MODE = wholemodule;
				SWIFT_OPTIMIZATION_LEVEL = "-O";
				VALIDATE_PRODUCT = YES;
			};
			name = Release;
		};
		7557FA9A24D0271500F80607 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_ENTITLEMENTS = "";
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_ASSET_PATHS = "\"NYTimes/Preview Content\"";
				DEVELOPMENT_TEAM = 7S7EBZGDA6;
				ENABLE_PREVIEWS = YES;
				INFOPLIST_FILE = NYTimes/Info.plist;
				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = com.waseem.NYTimes.example;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SUPPORTS_MACCATALYST = NO;
				SWIFT_VERSION = 5.0;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
			name = Debug;
		};
		7557FA9B24D0271500F80607 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				CODE_SIGN_ENTITLEMENTS = "";
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_ASSET_PATHS = "\"NYTimes/Preview Content\"";
				DEVELOPMENT_TEAM = 7S7EBZGDA6;
				ENABLE_PREVIEWS = YES;
				INFOPLIST_FILE = NYTimes/Info.plist;
				IPHONEOS_DEPLOYMENT_TARGET = 14.0;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = com.waseem.NYTimes.example;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SUPPORTS_MACCATALYST = NO;
				SWIFT_VERSION = 5.0;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
			name = Release;
		};
		75DDE51524D4094F00F9F165 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				BUNDLE_LOADER = "$(TEST_HOST)";
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_TEAM = Z43AQF953J;
				INFOPLIST_FILE = NYTimesTests/NYTimesTestInfo.plist;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
					"@loader_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = com.waseem.NYTimesTests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_VERSION = 5.0;
				TARGETED_DEVICE_FAMILY = "1,2";
				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NYTimes.app/NYTimes";
			};
			name = Debug;
		};
		75DDE51624D4094F00F9F165 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				BUNDLE_LOADER = "$(TEST_HOST)";
				CODE_SIGN_STYLE = Automatic;
				DEVELOPMENT_TEAM = Z43AQF953J;
				INFOPLIST_FILE = NYTimesTests/NYTimesTestInfo.plist;
				LD_RUNPATH_SEARCH_PATHS = (
					"$(inherited)",
					"@executable_path/Frameworks",
					"@loader_path/Frameworks",
				);
				PRODUCT_BUNDLE_IDENTIFIER = com.waseem.NYTimesTests;
				PRODUCT_NAME = "$(TARGET_NAME)";
				SWIFT_VERSION = 5.0;
				TARGETED_DEVICE_FAMILY = "1,2";
				TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NYTimes.app/NYTimes";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		7557FA7224D0271400F80607 /* Build configuration list for PBXProject "NYTimes" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				7557FA9724D0271500F80607 /* Debug */,
				7557FA9824D0271500F80607 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		7557FA9924D0271500F80607 /* Build configuration list for PBXNativeTarget "NYTimes" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				7557FA9A24D0271500F80607 /* Debug */,
				7557FA9B24D0271500F80607 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		75DDE51424D4094F00F9F165 /* Build configuration list for PBXNativeTarget "NYTimesTests" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				75DDE51524D4094F00F9F165 /* Debug */,
				75DDE51624D4094F00F9F165 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
		75C2758624D0AEBC00A7A651 /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
			isa = XCRemoteSwiftPackageReference;
			repositoryURL = "https://github.com/scinfu/SwiftSoup";
			requirement = {
				kind = upToNextMajorVersion;
				minimumVersion = 2.3.2;
			};
		};
		75D4FB5125653D7F0095AC82 /* XCRemoteSwiftPackageReference "Reachability" */ = {
			isa = XCRemoteSwiftPackageReference;
			repositoryURL = "https://github.com/ashleymills/Reachability.swift";
			requirement = {
				kind = upToNextMajorVersion;
				minimumVersion = 5.1.0;
			};
		};
		75F6869724D19C5C003E0E4A /* XCRemoteSwiftPackageReference "Kingfisher" */ = {
			isa = XCRemoteSwiftPackageReference;
			repositoryURL = "https://github.com/onevcat/Kingfisher";
			requirement = {
				kind = upToNextMajorVersion;
				minimumVersion = 5.14.1;
			};
		};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
		75C2758724D0AEBC00A7A651 /* SwiftSoup */ = {
			isa = XCSwiftPackageProductDependency;
			package = 75C2758624D0AEBC00A7A651 /* XCRemoteSwiftPackageReference "SwiftSoup" */;
			productName = SwiftSoup;
		};
		75D4FB5225653D7F0095AC82 /* Reachability */ = {
			isa = XCSwiftPackageProductDependency;
			package = 75D4FB5125653D7F0095AC82 /* XCRemoteSwiftPackageReference "Reachability" */;
			productName = Reachability;
		};
		75F6869824D19C5C003E0E4A /* Kingfisher */ = {
			isa = XCSwiftPackageProductDependency;
			package = 75F6869724D19C5C003E0E4A /* XCRemoteSwiftPackageReference "Kingfisher" */;
			productName = Kingfisher;
		};
		75F6869A24D19C5C003E0E4A /* KingfisherSwiftUI */ = {
			isa = XCSwiftPackageProductDependency;
			package = 75F6869724D19C5C003E0E4A /* XCRemoteSwiftPackageReference "Kingfisher" */;
			productName = KingfisherSwiftUI;
		};
/* End XCSwiftPackageProductDependency section */

/* Begin XCVersionGroup section */
		7557FA7E24D0271400F80607 /* NYTimes.xcdatamodeld */ = {
			isa = XCVersionGroup;
			children = (
				7557FA7F24D0271400F80607 /* NYTimes.xcdatamodel */,
			);
			currentVersion = 7557FA7F24D0271400F80607 /* NYTimes.xcdatamodel */;
			path = NYTimes.xcdatamodeld;
			sourceTree = "<group>";
			versionGroupType = wrapper.xcdatamodel;
		};
/* End XCVersionGroup section */
	};
	rootObject = 7557FA6F24D0271400F80607 /* Project object */;
}


================================================
FILE: NYTimes.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
   version = "1.0">
   <FileRef
      location = "self:">
   </FileRef>
</Workspace>


================================================
FILE: NYTimes.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>IDEDidComputeMac32BitWarning</key>
	<true/>
</dict>
</plist>


================================================
FILE: NYTimes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
================================================
{
  "object": {
    "pins": [
      {
        "package": "Kingfisher",
        "repositoryURL": "https://github.com/onevcat/Kingfisher",
        "state": {
          "branch": null,
          "revision": "fd6aee6d3774db191b22e331cc88f00041a2ca85",
          "version": "5.14.1"
        }
      },
      {
        "package": "Reachability",
        "repositoryURL": "https://github.com/ashleymills/Reachability.swift",
        "state": {
          "branch": null,
          "revision": "c01bbdf2d633cf049ae1ed1a68a2020a8bda32e2",
          "version": "5.1.0"
        }
      },
      {
        "package": "SwiftSoup",
        "repositoryURL": "https://github.com/scinfu/SwiftSoup",
        "state": {
          "branch": null,
          "revision": "774dc9c7213085db8aa59595e27c1cd22e428904",
          "version": "2.3.2"
        }
      }
    ]
  },
  "version": 1
}


================================================
FILE: NYTimes.xcodeproj/xcshareddata/xcschemes/NYTimes.xcscheme
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "1200"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "YES">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "YES"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "7557FA7624D0271400F80607"
               BuildableName = "NYTimes.app"
               BlueprintName = "NYTimes"
               ReferencedContainer = "container:NYTimes.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      shouldUseLaunchSchemeArgsEnv = "YES"
      codeCoverageEnabled = "YES">
      <Testables>
         <TestableReference
            skipped = "NO">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "75DDE50C24D4094F00F9F165"
               BuildableName = "NYTimesTests.xctest"
               BlueprintName = "NYTimesTests"
               ReferencedContainer = "container:NYTimes.xcodeproj">
            </BuildableReference>
         </TestableReference>
      </Testables>
   </TestAction>
   <LaunchAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      debugServiceExtension = "internal"
      allowLocationSimulation = "YES">
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "7557FA7624D0271400F80607"
            BuildableName = "NYTimes.app"
            BlueprintName = "NYTimes"
            ReferencedContainer = "container:NYTimes.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
      <EnvironmentVariables>
         <EnvironmentVariable
            key = "OS_ACTIVITY_MODE"
            value = "disable"
            isEnabled = "YES">
         </EnvironmentVariable>
      </EnvironmentVariables>
   </LaunchAction>
   <ProfileAction
      buildConfiguration = "Release"
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      debugDocumentVersioning = "YES">
      <BuildableProductRunnable
         runnableDebuggingMode = "0">
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "7557FA7624D0271400F80607"
            BuildableName = "NYTimes.app"
            BlueprintName = "NYTimes"
            ReferencedContainer = "container:NYTimes.xcodeproj">
         </BuildableReference>
      </BuildableProductRunnable>
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>


================================================
FILE: NYTimes.xcodeproj/xcuserdata/sameernawaz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
   uuid = "2DAFB1EC-28FE-4541-847E-80B7A6EEA66C"
   type = "1"
   version = "2.0">
</Bucket>


================================================
FILE: NYTimes.xcodeproj/xcuserdata/waseemakram.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
   uuid = "B9829A69-4C85-494D-82A6-2188C4E73FE9"
   type = "1"
   version = "2.0">
   <Breakpoints>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            uuid = "EA8C33AD-2781-4714-8FD1-0CE88E4D5323"
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "NYTimes/ViewModel/BookmarkViewModel.swift"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "37"
            endingLineNumber = "37"
            landmarkName = "bookmark(for:)"
            landmarkType = "7">
            <Locations>
               <Location
                  uuid = "EA8C33AD-2781-4714-8FD1-0CE88E4D5323 - 5abe80a212f22279"
                  shouldBeEnabled = "Yes"
                  ignoreCount = "0"
                  continueAfterRunningActions = "No"
                  symbolName = "NYTimes.BookmarkViewModel.bookmark(for: NYTimes.Article) -&gt; ()"
                  moduleName = "NYTimes"
                  usesParentBreakpointCondition = "Yes"
                  urlString = "file:///Users/waseemakram/Desktop/NYTimes/NYTimes/ViewModel/BookmarkViewModel.swift"
                  startingColumnNumber = "9223372036854775807"
                  endingColumnNumber = "9223372036854775807"
                  startingLineNumber = "36"
                  endingLineNumber = "36"
                  offsetFromSymbolStart = "148">
               </Location>
               <Location
                  uuid = "EA8C33AD-2781-4714-8FD1-0CE88E4D5323 - 897b7bb2119d795c"
                  shouldBeEnabled = "Yes"
                  ignoreCount = "0"
                  continueAfterRunningActions = "No"
                  symbolName = "closure #1 (Swift.Bool) -&gt; () in NYTimes.BookmarkViewModel.bookmark(for: NYTimes.Article) -&gt; ()"
                  moduleName = "NYTimes"
                  usesParentBreakpointCondition = "Yes"
                  urlString = "file:///Users/waseemakram/Desktop/NYTimes/NYTimes/ViewModel/BookmarkViewModel.swift"
                  startingColumnNumber = "9223372036854775807"
                  endingColumnNumber = "9223372036854775807"
                  startingLineNumber = "36"
                  endingLineNumber = "36"
                  offsetFromSymbolStart = "40">
               </Location>
            </Locations>
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            uuid = "1A7F23EB-E9BF-49EA-9BF2-C0E102AC919B"
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "NYTimes/Repository/BookmarkRepository.swift"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "75"
            endingLineNumber = "75"
            landmarkName = "insert(article:completion:)"
            landmarkType = "7">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
         <BreakpointContent
            uuid = "B9CDBDFF-4971-43A4-B24A-7732812F2D0A"
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            filePath = "NYTimes/Views/BookmarksView.swift"
            startingColumnNumber = "9223372036854775807"
            endingColumnNumber = "9223372036854775807"
            startingLineNumber = "53"
            endingLineNumber = "53">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
         <BreakpointContent
            uuid = "18AE96FC-BF7E-4B68-9BE2-619129467130"
            shouldBeEnabled = "No"
            nameForDebugger = "Exception"
            ignoreCount = "0"
            continueAfterRunningActions = "No"
            breakpointStackSelectionBehavior = "1"
            scope = "0"
            stopOnStyle = "0">
         </BreakpointContent>
      </BreakpointProxy>
      <BreakpointProxy
         BreakpointExtensionID = "Xcode.Breakpoint.SwiftErrorBreakpoint">
         <BreakpointContent
            uuid = "B5BF5C38-571C-4581-8E17-5FAA415693C2"
            shouldBeEnabled = "No"
            ignoreCount = "0"
            continueAfterRunningActions = "No">
         </BreakpointContent>
      </BreakpointProxy>
   </Breakpoints>
</Bucket>


================================================
FILE: NYTimes.xcodeproj/xcuserdata/waseemakram.xcuserdatad/xcschemes/xcschememanagement.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>SchemeUserState</key>
	<dict>
		<key>NYTimes.xcscheme_^#shared#^_</key>
		<dict>
			<key>orderHint</key>
			<integer>0</integer>
		</dict>
	</dict>
	<key>SuppressBuildableAutocreation</key>
	<dict>
		<key>7557FA7624D0271400F80607</key>
		<dict>
			<key>primary</key>
			<true/>
		</dict>
		<key>7557FA8F24D0271500F80607</key>
		<dict>
			<key>primary</key>
			<true/>
		</dict>
	</dict>
</dict>
</plist>


================================================
FILE: NYTimesTests/ArticleRepositoryTest.swift
================================================
//
//  ArticleRepositoryTest.swift
//  NYTimesTests
//
//  Created by Waseem Akram on 31/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import XCTest
@testable import NYTimes

class ArticleRepositoryTest: XCTestCase {

    var articleRepository: ArticleRepository!

    override func setUp() {
        articleRepository = ArticleRepository()
    }
    
    func testScienceArticles(){
        articleRepository.fetchArticles(for: .science) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty science articles")
        }
    }
    
    func testSportsArticles(){
        articleRepository.fetchArticles(for: .sports) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty sports articles")
        }
    }
    
    func testTechArticles(){
        articleRepository.fetchArticles(for: .tech) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty tech articles")
        }
    }
    
    func testBusinessArticles(){
        articleRepository.fetchArticles(for: .business) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty business articles")
        }
    }
    
    func testYourMoneyArticles(){
        articleRepository.fetchArticles(for: .yourmoney) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty your money articles")
        }
    }
    
    func testEducationArticles(){
        articleRepository.fetchArticles(for: .education) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty education articles")
        }
    }
    
    func testSpaceArticles(){
        articleRepository.fetchArticles(for: .space) { (articles) in
            XCTAssertNotNil(articles)
            XCTAssertGreaterThan(articles?.count ?? 0, 0, "Empty space articles")
        }
    }
    
    override func tearDown() {
        articleRepository = nil
    }

}


================================================
FILE: NYTimesTests/NYTimesTestInfo.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleVersion</key>
	<string>1</string>
</dict>
</plist>


================================================
FILE: NYTimesTests/NYTimesTests.swift
================================================
//
//  NYTimesTests.swift
//  NYTimesTests
//
//  Created by Waseem Akram on 31/07/20.
//  Copyright © 2020 Waseem Akram. All rights reserved.
//

import XCTest
@testable import NYTimes


class NYTimesTests: XCTestCase {
    
  

}


================================================
FILE: README.md
================================================
![](https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/Banner%400.25x.png)
![SwiftUI](https://img.shields.io/badge/Interface-SwfitUI-red)
![Architecture](https://img.shields.io/badge/Architecture-MVVM-green)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/TheCodeMonks/NYTimes-iOS/blob/master/LICENSE)
![GitHub forks](https://img.shields.io/github/forks/TheCodeMonks/NYTimes-iOS?label=Fork&style=social)
![GitHub Stars](https://img.shields.io/github/stars/TheCodeMonks/NYTimes-iOS?label=Stars&style=social)
![GitHub Watchers](https://img.shields.io/github/watchers/TheCodeMonks/NYTimes-iOS?label=Watchers&style=social)


[![Twitter URL](https://img.shields.io/twitter/url?style=social&url=https://github.com/TheCodeMonks/NYTimes-iOS)](http://twitter.com/share?text=Checkout+this+cool+project+made+with+SwiftUI,+by+@iamwaseem99&url=https://github.com/TheCodeMonks/NYTimes-iOS&hashtags=swiftui,ios,iphone,news,github,iosdevelopers,swift,xcode)
[![Twitter Follow](https://img.shields.io/twitter/follow/iamwaseem99?style=social)](https://twitter.com/iamwaseem99)



# NYTimes

NY Times is an Minimal News 🗞 iOS application built to describe the use of **SwiftSoup** and **CoreData** with **SwiftUI**.

## ⛓ Features

<table style="width:100%">
  <tr>
    <th>Articles Loading </th>
    <th>Browse by Category</th> 
  </tr>
  <tr>
    <td><img src="https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/gifs/HomeLoading.gif" width=250 height=600 /></td> 
    <td><img src="https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/gifs/browseByCategories.gif" width=250 height=600 /></td> 
  </tr>
  <tr>
    <th>Bookmark a Article using 3D Touch. </th>
    <th>Deleting bookmarks is just one swipe away</th> 
  </tr>
  <tr>
    <td><img src="https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/gifs/bookmark3d.gif" width=250 height=600 /></td>
    <td><img src="https://github.com/TheCodeMonks/NYTimes-iOS/blob/master/NYTimes%20Screenshots/gifs/manageBookmark.gif" width=250 height=600 /></td>
  </tr>
</table>

## 📝 Table of Contents  
- [Requirements](#requirements)
- [What you can learn?](#whatyoucanlearn)
- [Technical Background](#techbackground)
- [Dependencies](#dependencies)
- [Project Structure](#projectstructure)
- [Features](#features)
- [Contribute](#contribute)
- [Contact](#contact)
- [License](#license)




<a name="requirements"/>

## ⚙️ Requirements
```
iOS 14+
Xcode 12.2 and Up
```

<a name="whatyoucanlearn"/>

## 📚 What you can learn?
- You can learn Technologies like
  - SwiftUI
  - CoreData
  - Combine
  - Web Scraping
- You can learn various Design patterns from this project such as
  - Dependency injection
  - Repository 
  - Singleton
  - Observers
- You can learn MVVM Two way binding Architecture for SwiftUI with Combine framework

<a name="techbackground"/>

## 🛠 Technical Background
- NYTimes App was made using SwiftUI as the Core interface with Two Way Binding MVVM Architecture using Combine framework. 
- CoreData is used to store the Article Bookmarks offline in device so that the user can access it at later time.
- SwiftSoup is used to scrap the required details from the NYTimes website.
- The User interface of this app mostly uses the inbuilt iOS components to keep the User experience close to the native feel.
- Bookmarks can be added as easy as a 3d-touch from Homescreen or a tap in bookmark icon in the detailed article screen.
- This project was built in the mindset of modularity and good coding patterns. Multiple design patterns like Dependency injection, Repository pattern, Singleton Pattern etc.

<a name="dependencies"/>

## 🔗 Dependencies

This project uses SPM (Swift Package Manager) as Dependency manager.

 - [SwiftSoup](https://github.com/scinfu/SwiftSoup)
 - [Kingfisher](https://github.com/onevcat/Kingfisher)
 - [Reachability](https://github.com/ashleymills/Reachability.swift)

<a name="projectstructure"/>

## ⛓ Project Structure

    NYTimes                 # Root Group
    .
    ├── Utilities           # Utilities for Fetching data ans Scraping HTML
    ├── Extensions          # Some useful extensions
    ├── Globals             # Contains App constants
    ├── Persistence         # Coredata files. Contains coredata model and Singleton for ManagedObjectContext
    ├── Views               # SwiftUI Views
    ├── Repository          # Repository for Coredata
    ├── ViewModel           # Viewmodels for SwiftUI Views
    ├── Model               # Model files
    |   └── Coredata Model  # Coredata model subclasses
    |
    └── Supporting files    # Misc. files like Appdelegate, SceneDelegate.

## Architecture
    
This app uses MVVM architecture.

![MVVM](https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/MVVM.jpeg)


<a name="contribute"/>

## ✏️ Contribute

If you want to contribute to this library, you're always welcome!

### What you can do
You can contribute us by filing issues, bugs and PRs.

### Before you do
Before you open a issue or report a bug, please check if the issue or bug is related to Xcode or SwiftUI.

### Contributing guidelines:
- Open issue regarding proposed change.
- Repo owner will contact you there.
- If your proposed change is approved, Fork this repo and do changes.
- Open PR against latest `dev` branch. Add nice description in PR.
- You're done!

## ☕️ Donation
If this project help you reduce time to develop, you can give me a cup of coffee :) 

[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/iamwaseem99)

<a name="contact"/>

## 📱 Contact

Have an project? DM us at 👇

Drop a mail to:- thecodemonksorg@gmail.com

<a name="license"/>

## ⚖️ [License](https://github.com/TheCodeMonks/NYTimes-iOS/blob/master/LICENSE)

```
MIT License

Copyright (c) 2020 TheCodeMonks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
Download .txt
gitextract_b4frkyue/

├── .github/
│   └── FUNDING.yml
├── LICENSE
├── NYTimes/
│   ├── Assets.xcassets/
│   │   ├── AppIcon.appiconset/
│   │   │   └── Contents.json
│   │   ├── Contents.json
│   │   └── categoryBackground.colorset/
│   │       └── Contents.json
│   ├── Extensions/
│   │   └── Reachability + Extensions.swift
│   ├── Globals/
│   │   └── Constants.swift
│   ├── Info.plist
│   ├── Model/
│   │   ├── Article.swift
│   │   ├── Bookmark.swift
│   │   ├── Category.swift
│   │   └── Coredata model/
│   │       ├── CDArticle+CoreDataClass.swift
│   │       └── CDArticle+CoreDataProperties.swift
│   ├── Persistence/
│   │   ├── NYTimes.xcdatamodeld/
│   │   │   ├── .xccurrentversion
│   │   │   └── NYTimes.xcdatamodel/
│   │   │       └── contents
│   │   └── PersistenceManager.swift
│   ├── Preview Content/
│   │   └── Preview Assets.xcassets/
│   │       └── Contents.json
│   ├── Repository/
│   │   └── BookmarkRepository.swift
│   ├── Supporting files/
│   │   ├── AppDelegate.swift
│   │   ├── Base.lproj/
│   │   │   └── LaunchScreen.storyboard
│   │   └── SceneDelegate.swift
│   ├── Utilities/
│   │   ├── Common Utils.swift
│   │   ├── HTMLScarperUtility.swift
│   │   └── NetworkReachabilty.swift
│   ├── ViewModel/
│   │   ├── ArticleViewModel.swift
│   │   └── BookmarkViewModel.swift
│   └── Views/
│       ├── BookmarksView.swift
│       ├── Categories/
│       │   ├── CategoriesView.swift
│       │   └── CategoriesViewModel.swift
│       ├── CategorySelector.swift
│       ├── NewsFeedView.swift
│       ├── RootView.swift
│       ├── WebView.swift
│       └── WebViewHolder.swift
├── NYTimes.xcodeproj/
│   ├── project.pbxproj
│   ├── project.xcworkspace/
│   │   ├── contents.xcworkspacedata
│   │   ├── xcshareddata/
│   │   │   ├── IDEWorkspaceChecks.plist
│   │   │   └── swiftpm/
│   │   │       └── Package.resolved
│   │   └── xcuserdata/
│   │       └── sameernawaz.xcuserdatad/
│   │           └── UserInterfaceState.xcuserstate
│   ├── xcshareddata/
│   │   └── xcschemes/
│   │       └── NYTimes.xcscheme
│   └── xcuserdata/
│       ├── sameernawaz.xcuserdatad/
│       │   └── xcdebugger/
│       │       └── Breakpoints_v2.xcbkptlist
│       └── waseemakram.xcuserdatad/
│           ├── xcdebugger/
│           │   └── Breakpoints_v2.xcbkptlist
│           └── xcschemes/
│               └── xcschememanagement.plist
├── NYTimesTests/
│   ├── ArticleRepositoryTest.swift
│   ├── NYTimesTestInfo.plist
│   └── NYTimesTests.swift
└── README.md
Condensed preview — 47 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (120K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 755,
    "preview": "# These are supported funding model platforms\n\ngithub: devwaseem # Replace with up to 4 GitHub Sponsors-enabled username"
  },
  {
    "path": "LICENSE",
    "chars": 1071,
    "preview": "MIT License\n\nCopyright (c) 2020 The Code Monks\n\nPermission is hereby granted, free of charge, to any person obtaining a "
  },
  {
    "path": "NYTimes/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 4025,
    "preview": "{\n  \"images\" : [\n    {\n      \"filename\" : \"40.png\",\n      \"idiom\" : \"iphone\",\n      \"scale\" : \"2x\",\n      \"size\" : \"20x2"
  },
  {
    "path": "NYTimes/Assets.xcassets/Contents.json",
    "chars": 63,
    "preview": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "NYTimes/Assets.xcassets/categoryBackground.colorset/Contents.json",
    "chars": 689,
    "preview": "{\n  \"colors\" : [\n    {\n      \"color\" : {\n        \"color-space\" : \"srgb\",\n        \"components\" : {\n          \"alpha\" : \"1"
  },
  {
    "path": "NYTimes/Extensions/Reachability + Extensions.swift",
    "chars": 1215,
    "preview": "//\n//  Reachability + Extensions.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 18/11/20.\n//  Copyright © 2020 Wase"
  },
  {
    "path": "NYTimes/Globals/Constants.swift",
    "chars": 1932,
    "preview": "//\n//  Commons.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 31/07/20.\n//  Copyright © 2020 Waseem Akram. All righ"
  },
  {
    "path": "NYTimes/Info.plist",
    "chars": 1884,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "NYTimes/Model/Article.swift",
    "chars": 1160,
    "preview": "//\n//  Article.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram. All righ"
  },
  {
    "path": "NYTimes/Model/Bookmark.swift",
    "chars": 393,
    "preview": "//\n//  Bookmark.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram. All rig"
  },
  {
    "path": "NYTimes/Model/Category.swift",
    "chars": 1062,
    "preview": "//\n//  Category.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. All rig"
  },
  {
    "path": "NYTimes/Model/Coredata model/CDArticle+CoreDataClass.swift",
    "chars": 253,
    "preview": "//\n//  CDArticle+CoreDataClass.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 01/08/20.\n//  Copyright © 2020 Waseem"
  },
  {
    "path": "NYTimes/Model/Coredata model/CDArticle+CoreDataProperties.swift",
    "chars": 850,
    "preview": "//\n//  CDArticle+CoreDataProperties.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 01/08/20.\n//  Copyright © 2020 W"
  },
  {
    "path": "NYTimes/Persistence/NYTimes.xcdatamodeld/.xccurrentversion",
    "chars": 260,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "NYTimes/Persistence/NYTimes.xcdatamodeld/NYTimes.xcdatamodel/contents",
    "chars": 1046,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<model type=\"com.apple.IDECoreDataModeler.DataModel\" documentVer"
  },
  {
    "path": "NYTimes/Persistence/PersistenceManager.swift",
    "chars": 1647,
    "preview": "//\n//  PersistanceManager.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akra"
  },
  {
    "path": "NYTimes/Preview Content/Preview Assets.xcassets/Contents.json",
    "chars": 63,
    "preview": "{\n  \"info\" : {\n    \"author\" : \"xcode\",\n    \"version\" : 1\n  }\n}\n"
  },
  {
    "path": "NYTimes/Repository/BookmarkRepository.swift",
    "chars": 4053,
    "preview": "//\n//  BookmarkRepository.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 31/07/20.\n//  Copyright © 2020 Waseem Akra"
  },
  {
    "path": "NYTimes/Supporting files/AppDelegate.swift",
    "chars": 1435,
    "preview": "//\n//  AppDelegate.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. All "
  },
  {
    "path": "NYTimes/Supporting files/Base.lproj/LaunchScreen.storyboard",
    "chars": 1665,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
  },
  {
    "path": "NYTimes/Supporting files/SceneDelegate.swift",
    "chars": 3252,
    "preview": "//\n//  SceneDelegate.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. Al"
  },
  {
    "path": "NYTimes/Utilities/Common Utils.swift",
    "chars": 419,
    "preview": "//\n//  Utils.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram. All rights"
  },
  {
    "path": "NYTimes/Utilities/HTMLScarperUtility.swift",
    "chars": 2111,
    "preview": "//\n//  HTMLScarpingUtility.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 04/08/20.\n//  Copyright © 2020 Waseem Akr"
  },
  {
    "path": "NYTimes/Utilities/NetworkReachabilty.swift",
    "chars": 903,
    "preview": "//\n//  NetworkReachabilty.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 18/11/20.\n//  Copyright © 2020 Waseem Akra"
  },
  {
    "path": "NYTimes/ViewModel/ArticleViewModel.swift",
    "chars": 1228,
    "preview": "//\n//  NewsFeedViewModel.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram"
  },
  {
    "path": "NYTimes/ViewModel/BookmarkViewModel.swift",
    "chars": 2528,
    "preview": "//\n//  BookmarkViewModel.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 31/07/20.\n//  Copyright © 2020 Waseem Akram"
  },
  {
    "path": "NYTimes/Views/BookmarksView.swift",
    "chars": 1589,
    "preview": "//\n//  BookmarksView.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. Al"
  },
  {
    "path": "NYTimes/Views/Categories/CategoriesView.swift",
    "chars": 1292,
    "preview": "//\n//  CategoriesView.swift\n//  NYTimes\n//\n//  Created by Sameer Nawaz on 09/10/21.\n//  Copyright © 2021 Waseem Akram. A"
  },
  {
    "path": "NYTimes/Views/Categories/CategoriesViewModel.swift",
    "chars": 1779,
    "preview": "//\n//  CategoriesViewModel.swift\n//  NYTimes\n//\n//  Created by Sameer Nawaz on 09/10/21.\n//  Copyright © 2021 Waseem Akr"
  },
  {
    "path": "NYTimes/Views/CategorySelector.swift",
    "chars": 2028,
    "preview": "//\n//  CategorySelector.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram."
  },
  {
    "path": "NYTimes/Views/NewsFeedView.swift",
    "chars": 2056,
    "preview": "//\n//  NewsFeedView.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. All"
  },
  {
    "path": "NYTimes/Views/RootView.swift",
    "chars": 5172,
    "preview": "//\n//  ContentView.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 28/07/20.\n//  Copyright © 2020 Waseem Akram. All "
  },
  {
    "path": "NYTimes/Views/WebView.swift",
    "chars": 2400,
    "preview": "//\n//  WebView.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram. All righ"
  },
  {
    "path": "NYTimes/Views/WebViewHolder.swift",
    "chars": 1540,
    "preview": "//\n//  WebViewHolder.swift\n//  NYTimes\n//\n//  Created by Waseem Akram on 29/07/20.\n//  Copyright © 2020 Waseem Akram. Al"
  },
  {
    "path": "NYTimes.xcodeproj/project.pbxproj",
    "chars": 34905,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 52;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "NYTimes.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "chars": 135,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"self:\">\n   </FileRef"
  },
  {
    "path": "NYTimes.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "chars": 238,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "NYTimes.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved",
    "chars": 867,
    "preview": "{\n  \"object\": {\n    \"pins\": [\n      {\n        \"package\": \"Kingfisher\",\n        \"repositoryURL\": \"https://github.com/onev"
  },
  {
    "path": "NYTimes.xcodeproj/xcshareddata/xcschemes/NYTimes.xcscheme",
    "chars": 3523,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"1200\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "NYTimes.xcodeproj/xcuserdata/sameernawaz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist",
    "chars": 140,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bucket\n   uuid = \"2DAFB1EC-28FE-4541-847E-80B7A6EEA66C\"\n   type = \"1\"\n   version"
  },
  {
    "path": "NYTimes.xcodeproj/xcuserdata/waseemakram.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist",
    "chars": 4732,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Bucket\n   uuid = \"B9829A69-4C85-494D-82A6-2188C4E73FE9\"\n   type = \"1\"\n   version"
  },
  {
    "path": "NYTimes.xcodeproj/xcuserdata/waseemakram.xcuserdatad/xcschemes/xcschememanagement.plist",
    "chars": 581,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "NYTimesTests/ArticleRepositoryTest.swift",
    "chars": 2165,
    "preview": "//\n//  ArticleRepositoryTest.swift\n//  NYTimesTests\n//\n//  Created by Waseem Akram on 31/07/20.\n//  Copyright © 2020 Was"
  },
  {
    "path": "NYTimesTests/NYTimesTestInfo.plist",
    "chars": 727,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "NYTimesTests/NYTimesTests.swift",
    "chars": 232,
    "preview": "//\n//  NYTimesTests.swift\n//  NYTimesTests\n//\n//  Created by Waseem Akram on 31/07/20.\n//  Copyright © 2020 Waseem Akram"
  },
  {
    "path": "README.md",
    "chars": 6988,
    "preview": "![](https://raw.githubusercontent.com/TheCodeMonks/NYTimes-iOS/master/NYTimes%20Screenshots/Banner%400.25x.png)\n![SwiftU"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the TheCodeMonks/NYTimes-iOS GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 47 files (106.5 KB), approximately 31.3k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!