Skip to content

Commit

Permalink
Merge pull request #36 from growthbook/fixed-bug-with-load-feature
Browse files Browse the repository at this point in the history
Fixed bug with the load feature
  • Loading branch information
vazarkevych committed Jun 16, 2023
2 parents 2755488 + 97d9fee commit 800f56f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/CommonMain/Features/FeaturesViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ protocol FeaturesFlowDelegate: AnyObject {

/// View Model for Features
class FeaturesViewModel {
weak var delegate: FeaturesFlowDelegate?
var delegate: FeaturesFlowDelegate?
let dataSource: FeaturesDataSource
var encryptionKey: String?

Expand Down Expand Up @@ -38,12 +38,12 @@ class FeaturesViewModel {
}

guard let apiUrl = apiUrl else { return }
dataSource.fetchFeatures(apiUrl: apiUrl) { [weak self] result in
dataSource.fetchFeatures(apiUrl: apiUrl) { result in
switch result {
case .success(let data):
self?.prepareFeaturesData(data: data)
self.prepareFeaturesData(data: data)
case .failure(let error):
self?.delegate?.featuresFetchFailed(error: .failedToLoadData, isRemote: true)
self.delegate?.featuresFetchFailed(error: .failedToLoadData, isRemote: true)
logger.error("Failed get features: \(error.localizedDescription)")
}
}
Expand Down

0 comments on commit 800f56f

Please sign in to comment.