{"id":26827956,"url":"https://github.com/tkoehlerlg/swiftuiwparticleloader","last_synced_at":"2025-08-25T13:14:22.325Z","repository":{"id":63921745,"uuid":"389436377","full_name":"tkoehlerlg/SwiftUIWPArticleLoader","owner":"tkoehlerlg","description":"A Wordpress Article Loader for SwiftUI.","archived":false,"fork":false,"pushed_at":"2021-12-10T11:24:20.000Z","size":109,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T02:02:26.252Z","etag":null,"topics":["swiftui","wordpress"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkoehlerlg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-25T20:34:50.000Z","updated_at":"2025-04-13T08:26:49.000Z","dependencies_parsed_at":"2023-01-14T14:15:20.416Z","dependency_job_id":null,"html_url":"https://github.com/tkoehlerlg/SwiftUIWPArticleLoader","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/tkoehlerlg/SwiftUIWPArticleLoader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkoehlerlg%2FSwiftUIWPArticleLoader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkoehlerlg%2FSwiftUIWPArticleLoader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkoehlerlg%2FSwiftUIWPArticleLoader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkoehlerlg%2FSwiftUIWPArticleLoader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkoehlerlg","download_url":"https://codeload.github.com/tkoehlerlg/SwiftUIWPArticleLoader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkoehlerlg%2FSwiftUIWPArticleLoader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260083848,"owners_count":22956407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swiftui","wordpress"],"created_at":"2025-03-30T12:18:07.836Z","updated_at":"2025-06-16T02:03:07.147Z","avatar_url":"https://github.com/tkoehlerlg.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftUIWPArticleLoader\n\nWelcome to WPArticleLoader!\n\nWith the WPArticleLoader, you can easily load Articles from your WordPress Website.\n\n## How to use?\nThe usage is very easy! The only thing you have to do is setting your website address and build a receiver for the Publisher:\n\n```swift\nlet handler = WPArticleLoader(websiteAdress: URL(staticString: \"https://ml-projects.de\"))\nhandler.fetchArticles()\n    .receive(on: DispatchQueue.main)\n    .sink { response in\n        switch response {\n        case let .failure(error):\n            print(error)\n        case .finished:\n            print(\"Articles loaded\")\n        }\n    } receiveValue: { response in\n        self.articles = response\n    }\n    .store(in: \u0026cancellables)\n```\n\n\nThe Article class holds the most important Data and interprets it. If you want to interpret the data on your own you can use the **ArticleLoadingService** and receive ContentfulArticle. In ContentfulArticle is the complete Data from the _JSON_ of the _REST API_. You can use the **ArticleLoadingService** like this:\n\n```swift\nlet articleURL = URL(staticString: \"https://ml-projects.de/wp-json/wp/v2/posts\")\nvar components = URLComponents(string: articleURL.absoluteString)!\n// this is to get the embeded Data too (The Embeded Data is used by the normal Loader too)\ncomponents.queryItems = [\n    URLQueryItem(name: \"_embed\", value: nil)\n]\n// Create a URLRequest\nlet request = URLRequest(url: components.url!)\n// Create the handler\nlet handler = ArticleLoadingService()\nhandler.fetchArticles(urlRequest: request)\n    .receive(on: DispatchQueue.main)\n    .sink { response in\n        switch response {\n        case let .failure(error):\n            print(error)\n        case .finished:\n            print(\"Contentful Articles loaded\")\n        }\n    } receiveValue: { response in\n        self.contentfulArticles = response\n    }\n    .store(in: \u0026cancellables)\n```\n\n### ImageLoader\nThe ImageLoader is another simplification, it loads the image for you so you don't have to, use it combination with AsyncImage:\n```swift\n// Example for the featuredImage\nAsyncImage(imageLoader: featuredImageLoader) {\n    // your Placeholder\n}\n```\nbut you can also receive the Image on your own or use the URL:\n```swift\n// Image\nif let featuredImage = featuredImageLoader.image {\n    Image(uiImage: featuredImage)\n}\n// URL\nfeaturedImageLoader.url\n```\nThe featuredImageLoader is an optinal because not every Article has an featuredImage.\n\n#### Use the ImageLoader for your URLs\nIf you want to use the ImageLoader for your own URLs, probably for URLs in content you can easily initialize it and use it with AsyncImage:\n```swift\n// Example for the featuredImage\nAsyncImage(imageLoader: ImageLoader(url: URL(staticString: \"youradress.com\"))) {\n    // your Placeholder\n}\n```\n\nDeveloped by: **Torben Köhler**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkoehlerlg%2Fswiftuiwparticleloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkoehlerlg%2Fswiftuiwparticleloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkoehlerlg%2Fswiftuiwparticleloader/lists"}