Skip to content

Commit 7d418a3

Browse files
committed
Add IMdB
1 parent a051415 commit 7d418a3

File tree

7 files changed

+112
-2
lines changed

7 files changed

+112
-2
lines changed

Images/imdb.png

1.11 MB
Loading

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## News
22

3-
iOS news app in the style of Apollo, Apple News, Artifact, Axios, BBC, Bluesky, Cash App, CNN, Facebook, Facebook News, FastNews, Flipboard, Instagram, Lil News, NBC News, Particle, Reddit, Robinhood, Tapestry, The New York Times, The Washington Post, The Wall Street Journal, Threads, UIKit, X (Twitter) :newspaper:
3+
iOS news app in the style of Apollo, Apple News, Artifact, Axios, BBC, Bluesky, Cash App, CNN, Facebook, Facebook News, FastNews, Flipboard, IMDb, Instagram, Lil News, NBC News, Particle, Reddit, Robinhood, Tapestry, The New York Times, The Washington Post, The Wall Street Journal, Threads, UIKit, X (Twitter) :newspaper:
44

55
![](https://github.com/dkhamsing/news/actions/workflows/xcodebuild-ios17.yml/badge.svg) ![](https://github.com/dkhamsing/news/actions/workflows/xcodebuild-ios18.yml/badge.svg)
66

@@ -9,7 +9,7 @@ iOS news app in the style of Apollo, Apple News, Artifact, Axios, BBC, Bluesky,
99

1010
<img width=300 src=Images/demo.gif>
1111

12-
<img src=Images/apollo.png height=400> <img src=Images/applenews.png height=400> <img src=Images/artifact.png height=400> <img src=Images/axios.png height=400> <img src=Images/bbc.png height=400> <img src=Images/bluesky.png height=400> <img src=Images/cashapp.png height=400> <img src=Images/cnn.png height=400> <img src=Images/facebook.png height=400> <img src=Images/facebooknews.png height=400> <img src=Images/flipboard.png height=400> <img src=Images/fastnews.png height=400> <img src=Images/instagram.png height=400> <img src=Images/lilnews.png height=400> <img src=Images/nbcnews.png height=400> <img src=Images/particle2.png height=400> <img src=Images/reddit.png height=400> <img src=Images/robinhood.png height=400> <img src=Images/tapestry.png height=400> <img src=Images/nyt.png height=400> <img src=Images/threads.png height=400> <img src=Images/wsj.png height=400> <img src=Images/washingtonpost.png height=400> <img src=Images/uikit.png height=400> <img src=Images/x.png height=400>
12+
<img src=Images/apollo.png height=400> <img src=Images/applenews.png height=400> <img src=Images/artifact.png height=400> <img src=Images/axios.png height=400> <img src=Images/bbc.png height=400> <img src=Images/bluesky.png height=400> <img src=Images/cashapp.png height=400> <img src=Images/cnn.png height=400> <img src=Images/facebook.png height=400> <img src=Images/facebooknews.png height=400> <img src=Images/flipboard.png height=400> <img src=Images/fastnews.png height=400> <img src=Images/fastnews.png height=400> <img src=Images/imdb.png height=400> <img src=Images/lilnews.png height=400> <img src=Images/nbcnews.png height=400> <img src=Images/particle2.png height=400> <img src=Images/reddit.png height=400> <img src=Images/robinhood.png height=400> <img src=Images/tapestry.png height=400> <img src=Images/nyt.png height=400> <img src=Images/threads.png height=400> <img src=Images/wsj.png height=400> <img src=Images/washingtonpost.png height=400> <img src=Images/uikit.png height=400> <img src=Images/x.png height=400>
1313

1414
#### Bonus
1515

@@ -36,6 +36,7 @@ iOS news app in the style of Apollo, Apple News, Artifact, Axios, BBC, Bluesky,
3636
- [Facebook](https://www.facebook.com)
3737
- [Facebook News](https://www.facebook.com)
3838
- [Flipboard](https://flipboard.com)
39+
- [IMDb](https://www.imdb.com)
3940
- [Instagram](https://www.instagram.com)
4041
- [Lil News](https://lil.software/)
4142
- [NBC News](https://www.nbcnews.com)

Xcode/TheNews.xcodeproj/project.pbxproj

+17
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
D74AB4E72D6AA5CE008DF432 /* ParticleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74AB4E52D6AA5CE008DF432 /* ParticleHandler.swift */; };
9696
D7563B882ADC56390093C3FF /* ThreadsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7563B862ADC56390093C3FF /* ThreadsCell.swift */; };
9797
D7563B892ADC56390093C3FF /* ThreadsHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7563B872ADC56390093C3FF /* ThreadsHandler.swift */; };
98+
D79333932D81D4F000115013 /* IMDbHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79333912D81D4F000115013 /* IMDbHandler.swift */; };
99+
D79333942D81D4F000115013 /* IMDbCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79333922D81D4F000115013 /* IMDbCell.swift */; };
98100
D7BC21C92D726BE10050836A /* TapestryHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7BC21C72D726BE10050836A /* TapestryHandler.swift */; };
99101
D7BC21CA2D726BE10050836A /* TapestryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7BC21C82D726BE10050836A /* TapestryCell.swift */; };
100102
D7E879102D7132D600370650 /* BlueskyCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7E8790E2D7132D600370650 /* BlueskyCell.swift */; };
@@ -218,6 +220,8 @@
218220
D74AB4E52D6AA5CE008DF432 /* ParticleHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParticleHandler.swift; sourceTree = "<group>"; };
219221
D7563B862ADC56390093C3FF /* ThreadsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadsCell.swift; sourceTree = "<group>"; };
220222
D7563B872ADC56390093C3FF /* ThreadsHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadsHandler.swift; sourceTree = "<group>"; };
223+
D79333912D81D4F000115013 /* IMDbHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMDbHandler.swift; sourceTree = "<group>"; };
224+
D79333922D81D4F000115013 /* IMDbCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IMDbCell.swift; sourceTree = "<group>"; };
221225
D7BC21C72D726BE10050836A /* TapestryHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TapestryHandler.swift; sourceTree = "<group>"; };
222226
D7BC21C82D726BE10050836A /* TapestryCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TapestryCell.swift; sourceTree = "<group>"; };
223227
D7E8790E2D7132D600370650 /* BlueskyCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueskyCell.swift; sourceTree = "<group>"; };
@@ -501,6 +505,7 @@
501505
65D47D9B25941140009701BB /* FacebookNews */,
502506
650785192587038E001ABDAE /* FastNews */,
503507
650785232587038E001ABDAE /* Flipboard */,
508+
D79333902D81D4F000115013 /* IMDb */,
504509
656F5BB926EE7994007C3C53 /* Instagram */,
505510
6507852B2587038E001ABDAE /* LilNews */,
506511
65A01C51258BD4ED007565AB /* NBCNews */,
@@ -598,6 +603,16 @@
598603
path = Threads;
599604
sourceTree = "<group>";
600605
};
606+
D79333902D81D4F000115013 /* IMDb */ = {
607+
isa = PBXGroup;
608+
children = (
609+
D79333912D81D4F000115013 /* IMDbHandler.swift */,
610+
D79333922D81D4F000115013 /* IMDbCell.swift */,
611+
);
612+
name = IMDb;
613+
path = TheNews/Views/IMDb;
614+
sourceTree = SOURCE_ROOT;
615+
};
601616
D7BC21C62D726BE10050836A /* Tapestry */ = {
602617
isa = PBXGroup;
603618
children = (
@@ -791,6 +806,7 @@
791806
D7E879102D7132D600370650 /* BlueskyCell.swift in Sources */,
792807
65C3837825872490008F1411 /* NewsApi.swift in Sources */,
793808
655C9712258E657400095493 /* AppleNewsCell.swift in Sources */,
809+
D79333932D81D4F000115013 /* IMDbHandler.swift in Sources */,
794810
65D47DA725941163009701BB /* FacebookNewsHandler.swift in Sources */,
795811
6507850E25870361001ABDAE /* NewsViewModel.swift in Sources */,
796812
6560AE5124411C4A00581008 /* AppDelegate.swift in Sources */,
@@ -836,6 +852,7 @@
836852
65215EDF24438F08008B4D5A /* ImageDownloader.swift in Sources */,
837853
6507854B2587038F001ABDAE /* LilNewsCell.swift in Sources */,
838854
650785AB25871091001ABDAE /* NewsCell.swift in Sources */,
855+
D79333942D81D4F000115013 /* IMDbCell.swift in Sources */,
839856
650785502587038F001ABDAE /* WSJHandler.swift in Sources */,
840857
D74AB4E72D6AA5CE008DF432 /* ParticleHandler.swift in Sources */,
841858
650785432587038F001ABDAE /* TwitterCell.swift in Sources */,

Xcode/TheNews/NewsViewController.swift

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class NewsViewController: UIViewController {
2424
var handlerFacebookNews = FacebookNewsHandler()
2525
var handlerFastNews = FastNewsHandler()
2626
var handlerFlipboard = FlipboardHandler()
27+
var handlerIMdB = IMDbHandler()
2728
var handlerInstagram = InstagramHandler()
2829
var handlerNBCNews = NBCNewsHandler()
2930
var handlerNYT = NYTHandler()
@@ -70,6 +71,7 @@ class NewsViewController: UIViewController {
7071
handlerFacebookNews.articles = articles
7172
handlerFastNews.articles = articles
7273
handlerFlipboard.articles = articles
74+
handlerIMdB.articles = articles
7375
handlerInstagram.articles = articles
7476
handlerLilNews.items = articles
7577
handlerNBCNews.articles = articles
@@ -204,6 +206,9 @@ private extension NewsViewController {
204206
case .flipboard:
205207
viewTable.dataSource = handlerFlipboard
206208
viewTable.delegate = handlerFlipboard
209+
case .imdb:
210+
viewTable.dataSource = handlerIMdB
211+
viewTable.delegate = handlerIMdB
207212
case .instagram:
208213
viewTable.dataSource = handlerInstagram
209214
viewTable.delegate = handlerInstagram

Xcode/TheNews/NewsViewModel.swift

+5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class NewsViewModel {
8888
facebooknews,
8989
fastnews,
9090
flipboard,
91+
imdb,
9192
instagram,
9293
lilnews,
9394
nbcnews,
@@ -112,6 +113,8 @@ class NewsViewModel {
112113
return "Facebook News"
113114
case .fastnews:
114115
return "FastNews"
116+
case .imdb:
117+
return "IMDb"
115118
case .lilnews:
116119
return "lil news"
117120
case .nbcnews:
@@ -168,6 +171,8 @@ class NewsViewModel {
168171
return [FastNewsCell.identifier]
169172
case .flipboard:
170173
return [FlipboardCell.identifier]
174+
case .imdb:
175+
return [IMDbCell.identifier]
171176
case .instagram:
172177
return [InstagramCell.identifier]
173178
case .lilnews:
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import UIKit
2+
3+
class IMDbCell: NewsCell {
4+
5+
static let identifier: String = "IMDbCell"
6+
7+
override func config() {
8+
super.config()
9+
10+
title.font = .preferredFont(forTextStyle: .subheadline)
11+
title.numberOfLines = 3
12+
13+
summary.font = title.font
14+
15+
summary.textColor = .secondaryLabel
16+
summary.numberOfLines = 2
17+
18+
source.font = .preferredFont(forTextStyle: .footnote)
19+
source.textColor = .secondaryLabel
20+
21+
ago.textColor = .secondaryLabel
22+
ago.font = .preferredFont(forTextStyle: .footnote)
23+
24+
[logo, title, source, ago, articleImageView, summary].forEach {
25+
contentView.addSubviewForAutoLayout($0)
26+
}
27+
28+
let imageWidth: CGFloat = 90
29+
let imageHeight: CGFloat = 130
30+
let inset: CGFloat = 8
31+
NSLayoutConstraint.activate([
32+
ago.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
33+
ago.topAnchor.constraint(equalTo: contentView.topAnchor, constant: inset + 5),
34+
35+
source.leadingAnchor.constraint(equalTo: ago.trailingAnchor, constant: inset),
36+
source.topAnchor.constraint(equalTo: ago.topAnchor),
37+
38+
title.topAnchor.constraint(equalTo: ago.bottomAnchor, constant: inset / 2),
39+
title.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
40+
41+
summary.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 5),
42+
summary.leadingAnchor.constraint(equalTo: title.leadingAnchor),
43+
summary.trailingAnchor.constraint(equalTo: articleImageView.leadingAnchor, constant: -inset),
44+
45+
articleImageView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: inset + 5),
46+
articleImageView.leadingAnchor.constraint(equalTo: title.trailingAnchor, constant: inset),
47+
articleImageView.heightAnchor.constraint(equalToConstant: imageHeight),
48+
articleImageView.widthAnchor.constraint(equalToConstant: imageWidth),
49+
contentView.readableContentGuide.trailingAnchor.constraint(equalTo: articleImageView.trailingAnchor),
50+
51+
contentView.bottomAnchor.constraint(equalTo: articleImageView.bottomAnchor, constant: inset + 5)
52+
])
53+
54+
}
55+
56+
func load(article: Article) {
57+
title.text = article.titleDisplay
58+
summary.text = article.descriptionOrContent
59+
source.text = article.source?.name
60+
ago.text = article.ago
61+
load(urlString: article.urlToImage, downloader: ImageDownloader.shared)
62+
}
63+
64+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import UIKit
2+
3+
class IMDbHandler: NewsTableHandler {
4+
5+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
6+
return articles.count
7+
}
8+
9+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
10+
let cell = tableView.dequeueReusableCell(withIdentifier: IMDbCell.identifier) as! IMDbCell
11+
12+
let article = articles[indexPath.row]
13+
cell.load(article: article)
14+
15+
return cell
16+
}
17+
18+
}

0 commit comments

Comments
 (0)