Итак, я обновил код проекта Xcode и GitHub до swift 3.0 (мой проект находится в Obj C, а некоторые из модулей, которые я использую из GitHub, находятся в Swift). Я получил кучу ошибок, и теперь я застрял на этих. По какой-то причине мой dataSource и делегат для floatActionButton (git here) теперь не работают. Я попытался установить dataSource
и delegate
программно и на раскадровке, но это не сработало.cant configure dataSource и делегат
Ошибки:
недвижимости 'DataSource' не найден на объект типа 'LiquidFloatingActionButton *'
Свойство 'делегат' не найден на объект типа 'LiquidFloatingActionButton *
Я считаю, что если я выясню проблему dataSource
и delegate
, тогда она исправит ошибку цвета ниже.
.h:
#import <UIKit/UIKit.h>
#import "ProductContentViewController.h"
#import "LiquidFloatingActionButton-swift.h"
@interface SetScreenViewController : UIViewController
<UIPageViewControllerDataSource, LiquidFloatingActionButtonDelegate, LiquidFloatingActionButtonDataSource>
...
@end
.m:
#import "LiquidFloatingActionButton-Swift.h"
LiquidFloatingActionButton *floatingActionButton;
NSMutableArray *liquidCells;
bool *closeFloatingButtons;
NSString *videoToWatchURL;
- (void)addLiquidButton{
//Grabs the coordinates bottom right of the screen
float X_Co = self.view.frame.size.width - 50;
float Y_Co = self.view.frame.size.height - 50;
//i subtract 10 so the button will be placed a little bit out
X_Co = X_Co - 10;
Y_Co = Y_Co - 10;
//I create each cell and set the image for each button
liquidCells = [[NSMutableArray alloc] init];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@".png"]]];
//Sets the floating button at the loaction provided
floatingActionButton = [[LiquidFloatingActionButton alloc] initWithFrame:CGRectMake(X_Co, Y_Co, 50, 50)];
floatingActionButton.dataSource = self;//Error here
floatingActionButton.delegate = self;//and here.
//I set the color of the floating button
floatingActionButton.color = [self colorWithHexString:@"01b8eb"];
//Enables the user interaction fuction to true so itll open or close
floatingActionButton.userInteractionEnabled = YES;
//Adds the flaoting button to the view
[self.view addSubview:floatingActionButton];
}
-(NSInteger)numberOfCells:(LiquidFloatingActionButton *)liquidFloatingActionButton{
return liquidCells.count;
}
-(LiquidFloatingCell *)cellForIndex:(NSInteger)index{
return [liquidCells objectAtIndex:index];
}
PodFile:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'Whats New' do
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Whats New
target 'Whats NewTests' do
inherit! :search_paths
# Pods for testing
end
target 'Whats NewUITests' do
inherit! :search_paths
# Pods for testing
end
pod 'CRToast', '~> 0.0.7'
pod "LiquidFloatingActionButton"
pod 'DGActivityIndicatorView'
pod 'M13ProgressSuite'
pod 'SDWebImage', '~>3.8'
pod 'FSCalendar'
use_frameworks!
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
end
UPDATE НИЖЕ
Я закончил с использованием this проекта, потому что оригинал GitHub не фиксированы, спасибо за всю помощь, и если кто-то делает это выяснить, пожалуйста, пусть все здесь знают!
Код цели-C, а не код Swift 3. – rmaddy
@rmaddy a-ha! Компонент был обновлен до Swift 3.0, а не кода OP. – Paulw11
@rmaddy мой проект находится в объективе c, GitHub используется в Swift. Извините, я не упоминал об этом. –