Skip to content
This repository was archived by the owner on Aug 18, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions brain-marks/Categories/Views/CategoryList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ struct CategoryList: View {
viewModel.getCategories()
}
.accentColor(.black)
.sheet(isPresented:$showAddURLView) {
AddURLView(categories: viewModel.categories)
}
.sheet(isPresented:$showAddURLView) {
AddURLView(categories: viewModel.categories)
}
}
}

Expand Down
18 changes: 18 additions & 0 deletions brain-marks/Tweets/Views/TweetList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ struct TweetList: View {

List(viewModel.tweets) { tweet in
TweetCard(tweet: tweet)
.onTapGesture {
print("opening twitter for \(tweet.tweetID)\(tweet.authorUsername)")
self.openTwitter(tweetID: tweet.tweetID, authorUsername: tweet.authorUsername!)
}

}
.toolbar {
ToolbarItem(placement: .principal) {
Expand All @@ -35,4 +40,17 @@ struct TweetList: View {

Spacer()
}
func openTwitter(tweetID:String, authorUsername:String){
let appURL = NSURL(string: "twitter://home")!
let webURL = NSURL(string: "https://twitter.com/\(authorUsername)/status/\(tweetID)?s=21")!

let application = UIApplication.shared

if application.canOpenURL(appURL as URL) {
application.open(appURL as URL)
} else {
application.open(webURL as URL)
}

}
}