Upgrade to Pro — share decks privately, control downloads, hide ads and more …

LINE占い iOS アプリ開発の現状 / LINE DM 15 about a LINE F...

LINE占い iOS アプリ開発の現状 / LINE DM 15 about a LINE Fortune development

This talk at LINE Developer Meetup in Fukuoka #15

H.Takeshita

July 29, 2016
Tweet

Other Decks in Technology

Transcript

  1. ݄ ݄ ݄ ݄ ݄ ϦϦʔε 7FSTJPO -*/&઎͍ ։ൃ෱ԬҠ؅ J04DVU

    7FSTJPO ݄ -*/&'VLVPLB ։ൃ্ཱࣨͪ͛   
  2. (FOFSBUFE*OUFSGBDF @interface ExampleModel : NSObject @property (nonatomic) NSNumber *amount; @property

    (nonatomic, copy) NSString *datetime; @property (nonatomic, copy) NSString *title; @end public class ExampleModel : NSObject { public var amount: NSNumber! public var datetime: String! public var title: String! }
  3. /VMMBCJMJUZ @property (nonnull, copy, nonatomic) NSString *name; @property (copy, nonatomic)

    NSString * __nonnull name; @property (copy, nonatomic) NSString * _Nonnull name; @property (nullable, copy, nonatomic) NSString *name; @property (copy, nonatomic) NSString * __nullable name; @property (copy, nonatomic) NSString * _Nullable name; - (void)example:(nonnull NSArray<NSString *> *)param; - (void)example:(NSArray<NSString *> * _Nonnull)param;
  4. /VMMBCJMJUZ // Objective-C + (NSString *)message; // ࣮͸ nil Λฦ͢ࣄ͕͋Δ

    // Swift Ͱ͸ func message() -> NSString! Example.message().characters // nil ฦͬͨ࣌ʹ Crash >< // Objective-C + (nullable NSString *)message; // nil ฦ͢ՄೳੑΛ໌ࣔ // Swift Ͱ͸ func message() -> NSString? Example.message()?.characters // Optional Ͱ nil safe
  5. /VMMBCJMJUZ ؂ࠪൣғʢ"VEJUFE3FHJPOTʣ NS_ASSUME_NONNULL_BEGIN @interface ExampleModel : NSObject @property (copy, nonatomic)

    NSString *name; @property (copy, nonatomic) NSString *country; @property (nullable, copy, nonatomic) NSString *hobby;
 @end NS_ASSUME_NONNULL_END
  6. -JHIU8FJHIU(FOFSJDT // Objective-C + (NSArray *)someArray { NSArray *var =

    @[@"test"]; return var; } // Swift Example.someArray()[0].characters
  7. -JHIU8FJHIU(FOFSJDT // Objective-C + (NSArray <NSString *> *)someArray { NSArray<NSString

    *> *var = @[@"test"]; return var; } // Swift Example.someArray()[0].characters
  8. -JHIU8FJHIU(FOFSJDT // Objective-C + (NSArray <NSString *> *)someArray { UIImage

    *image = [UIImage imageNamed:@"example.png"]; NSArray<UIImage *> *var = @[image]; return var; }
  9. -JHIU8FJHIU(FOFSJDT // Objective-C + (NSArray <NSString *> *)someArray { UIImage

    *image = [UIImage imageNamed:@"example.png"]; NSArray<UIImage *> *var = @[image]; return var; } // Swift Example.someArray()[0].characters
  10. -JHIU8FJHIU(FOFSJDT NSMutableArray<UIView *> *array = [@[] mutableCopy]; // MyView ͸

    UIView ͷαϒΫϥε [array addObject:[MyView new]]; MyView *myView = array[0];
  11. -JHIU8FJHIU(FOFSJDT NSMutableArray<__kindof UIView *> *array = [@[] mutableCopy]; // MyView

    ͸ UIView ͷαϒΫϥε [array addObject:[MyView new]]; MyView *myView = array[0];
  12. ϨΠΞ΢τ _textLabel.frame = (CGRect){ .origin.x = 0., .origin.y = CGRectGetMaxX(self.itemImageView.frame)

    + 3., .size.width = CGRectGetWidth(self.itemImageView.frame), .size.height = _textLabel.font.lineHeight * 2. + 7. };
  13. ϨΠΞ΢τ ౰વ"VUP-BZPVU࢖͏͔ΒYJCԽ͍ͯ͜͠͏ _textLabel.frame = (CGRect){ .origin.x = 0., .origin.y =

    CGRectGetMaxX(self.itemImageView.frame) + 3., .size.width = CGRectGetWidth(self.itemImageView.frame), .size.height = _textLabel.font.lineHeight * 2. + 7. };
  14. ϨΠΞ΢τ @IBInspectable var borderColor: UIColor = UIColor.clearColor() { didSet {

    layer.borderColor = borderColor.CGColor } } @IBInspectable var cornerRadius: CGFloat = 0 { didSet { layer.cornerRadius = cornerRadius } } *#*OTQFDUBCMF
  15. ϨΠΞ΢τ @IBInspectable var borderColor: UIColor = UIColor.clearColor() { didSet {

    layer.borderColor = borderColor.CGColor } } @IBInspectable var cornerRadius: CGFloat = 0 { didSet { layer.cornerRadius = cornerRadius } } *#*OTQFDUBCMF
  16. ϨΠΞ΢τ 6*7JFX$POUSPMMFS4UPSZ#PBSEԽ import UIKit protocol StoryBoardable extension StoryBoardable where Self:

    UIViewController { static func viewControllerFromStoryboard() -> Self { let storyboard = UIStoryboard(name: className, bundle: nil) return storyboard.instantiateViewControllerWithIdentifier( className ) as! Self } }
  17. ϨΠΞ΢τ 6*7JFX$POUSPMMFS4UPSZ#PBSEԽ // for Objective-C extension UIViewController { @available(*, unavailable)

    @objc static func viewControllerFromStoryboard() -> UIViewController { let storyboard = UIStoryboard(name: className, bundle: nil) return storyboard. instantiateViewControllerWithIdentifier(className) } }
  18. ϨΠΞ΢τ 6*7JFX$POUSPMMFS4UPSZ#PBSEԽ // from Swift let vc = viewControllerFromStoryboard() //

    from Objective-C MyViewController *viewController = (MyViewController *)[MyViewController viewControllerFromStoryboard];