Swift: Expected ',' separator
Closed this issue · 1 comments
xousef commented
I get this error at
i got other stuff in this class
here is my code:
import Foundation
import UIKit
import ObjectiveC
class myMenuClass: UIViewController {
@IBOutlet weak var wheel: UIImageView!
@IBOutlet weak var spinValueLabel: UILabel!
@IBOutlet weak var roundMenu: XXXRoundMenuButton!
var spinnerView = SpinnerView(frame: CGRect.zero)
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
addSpinnerView()
spinnerView.addOval()
let roundMenu = XXXRoundMenuButton();
self.view.addSubview(roundMenu);
roundMenu.frame = CGRectMake(self.view.frame.size.width/2-100, self.view.frame.size.height/2-100, 200, 200);
roundMenu.centerButtonSize = CGSizeMake(44, 44);
roundMenu.tintColor = UIColor.whiteColor();
roundMenu.jumpOutButtonOnebyOne = true;
roundMenu.loadButtonWithIcons([UIImage(named: "icon_can")!,UIImage(named: "icon_pos")!,UIImage(named: "icon_img")!], startDegree: -M_PI, layoutDegree: M_PI/2);
roundMenu.buttonClickBlock = {(idx:NSInteger)-> Void in
NSLog("%d", idx);
};
self.roundMenu.centerButtonSize = CGSizeMake(44, 44);
self.roundMenu.centerIconType = XXXIconTypeUserDraw;
self.roundMenu.tintColor = [UIColor whiteColor];
self.roundMenu.jumpOutButtonOnebyOne = YES;
[self.roundMenu setDrawCenterButtonIconBlock:^(CGRect rect, UIControlState state) {
if (state == UIControlStateNormal)
{
UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 - 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectanglePath fill];
UIBezierPath* rectangle2Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle2Path fill];
UIBezierPath* rectangle3Path = [UIBezierPath bezierPathWithRect: CGRectMake((rect.size.width - 15)/2, rect.size.height/2 + 5, 15, 1)];
[UIColor.whiteColor setFill];
[rectangle3Path fill];
}
}];
[self.roundMenu loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"],
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]
] startDegree:0 layoutDegree:M_PI*2*7/8];
[self.roundMenu setButtonClickBlock:^(NSInteger idx) {
NSLog(@"button %@ clicked !",@(idx));
}];
/**
* RoundMenu2 config
*/
[self.roundMenu2 loadButtonWithIcons:@[
[UIImage imageNamed:@"icon_can"],
[UIImage imageNamed:@"icon_pos"],
[UIImage imageNamed:@"icon_img"]
] startDegree:-M_PI layoutDegree:M_PI/2];
[self.roundMenu2 setButtonClickBlock:^(NSInteger idx) {
NSLog(@"button %@ clicked !",@(idx));
}];
self.roundMenu2.tintColor = [UIColor whiteColor];
self.roundMenu2.mainColor = [UIColor colorWithRed:0.13 green:0.58 blue:0.95 alpha:1];
}
}
override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.
}
@IBAction func spinBuutonAction(_ sender: UIButton) {
spinnerView.callSpinTimer()
}
func addSpinnerView() {
let boxSize: CGFloat = 100.00
spinnerView.frame = CGRect(x: view.bounds.width / 2 - boxSize / 2,
y: view.bounds.height / 2 - boxSize / 2,
width: boxSize,
height: boxSize)
spinnerView.parentFrame = view.frame
spinnerView.delegate = self
view.addSubview(spinnerView)
}
extension RouletteClass: spinnerProtocol {
func spinValueAfterCompleteRoatation(value: Float) {
let radianToDegree = Int(value * 180 / .pi)
spinValueLabel.text = "\(radianToDegree)"
}
override open var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override open var prefersStatusBarHidden: Bool {
return true
}
}
zsy78191 commented
I think you maybe copy some Objective-C code for swift.