Skip to content

Commit ad8dee9

Browse files
committed
Swift migration to 3.0;
fixed deprecated API usage
1 parent 8b50511 commit ad8dee9

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

VBPieChart/Classes/VBPiePiece_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef VBPiePiece_private_h
1010
#define VBPiePiece_private_h
1111

12+
#import <UIKit/UIKit.h>
13+
1214
// Private class
1315
@interface VBPiePieceData : NSObject
1416
@property (nonatomic) NSInteger index;

VBPieChart_swift/VBPieChart_swift.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@
180180
TargetAttributes = {
181181
D21E0E221A8A501100366D57 = {
182182
CreatedOnToolsVersion = 6.1.1;
183+
DevelopmentTeam = DHKZ7WR43P;
184+
LastSwiftMigration = 0830;
183185
};
184186
D21E0E371A8A501100366D57 = {
185187
CreatedOnToolsVersion = 6.1.1;
@@ -361,11 +363,13 @@
361363
buildSettings = {
362364
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
363365
CLANG_ENABLE_MODULES = YES;
366+
DEVELOPMENT_TEAM = DHKZ7WR43P;
364367
INFOPLIST_FILE = VBPieChart_swift/Info.plist;
365368
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
366369
PRODUCT_NAME = "$(TARGET_NAME)";
367370
SWIFT_OBJC_BRIDGING_HEADER = "VBPieChart_swift/VBPieChart_swift-Bridging-Header.h";
368371
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
372+
SWIFT_VERSION = 3.0;
369373
};
370374
name = Debug;
371375
};
@@ -374,10 +378,12 @@
374378
buildSettings = {
375379
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
376380
CLANG_ENABLE_MODULES = YES;
381+
DEVELOPMENT_TEAM = DHKZ7WR43P;
377382
INFOPLIST_FILE = VBPieChart_swift/Info.plist;
378383
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
379384
PRODUCT_NAME = "$(TARGET_NAME)";
380385
SWIFT_OBJC_BRIDGING_HEADER = "VBPieChart_swift/VBPieChart_swift-Bridging-Header.h";
386+
SWIFT_VERSION = 3.0;
381387
};
382388
name = Release;
383389
};

VBPieChart_swift/VBPieChart_swift/AppDelegate.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1818
// Override point for customization after application launch.
1919
return true
2020
}
2121

22-
func applicationWillResignActive(application: UIApplication) {
22+
func applicationWillResignActive(_ application: UIApplication) {
2323
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
2424
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
2525
}
2626

27-
func applicationDidEnterBackground(application: UIApplication) {
27+
func applicationDidEnterBackground(_ application: UIApplication) {
2828
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
2929
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
3030
}
3131

32-
func applicationWillEnterForeground(application: UIApplication) {
32+
func applicationWillEnterForeground(_ application: UIApplication) {
3333
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
3434
}
3535

36-
func applicationDidBecomeActive(application: UIApplication) {
36+
func applicationDidBecomeActive(_ application: UIApplication) {
3737
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
3838
}
3939

40-
func applicationWillTerminate(application: UIApplication) {
40+
func applicationWillTerminate(_ application: UIApplication) {
4141
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4242
}
4343

VBPieChart_swift/VBPieChart_swift/ViewController.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class ViewController: UIViewController {
1717

1818
self.view.addSubview(chart);
1919

20-
chart.frame = CGRectMake(10, 50, 300, 300);
21-
chart.enableStrokeColor = true;
20+
chart.frame = CGRect(x: 10, y: 50, width: 300, height: 300);
2221
chart.holeRadiusPrecent = 0.3;
2322

2423

@@ -37,7 +36,7 @@ class ViewController: UIViewController {
3736
// Do any additional setup after loading the view, typically from a nib.
3837
}
3938

40-
override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
39+
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
4140

4241
}
4342

0 commit comments

Comments
 (0)