Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Swift] String Extension #70

Closed
seungchan2 opened this issue Jun 1, 2022 · 0 comments
Closed

[Swift] String Extension #70

seungchan2 opened this issue Jun 1, 2022 · 0 comments
Assignees
Labels

Comments

@seungchan2
Copy link
Owner

import Foundation

extension String {
    func removeString() -> String {
        return self.replacingOccurrences(of: "<b>", with: "").replacingOccurrences(of: "</b>", with: "")
    }
}
 func fetchData(query: String) {
        MovieDataManager.shared.fetchMovie(query: movieQuery.value) {[weak self] (movies) in
            guard let self = self else { return }
            if let movies = movies {
                movies.forEach {
                    let actor = $0.actor.removeString()
                    let director = $0.director.removeString()
                    let title = $0.title.removeString()
                    let data = MovieInfo(title: title , image: $0.image, director: director, actor: actor)
                    self.downloadedMovies.value.movie += [data]
                }
            }
        }
    }
@seungchan2 seungchan2 self-assigned this Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant