Git Product home page Git Product logo

uswcao-quiz's Introduction

uswcao-quiz

This repository contains set of questions for a self-check based on the book "Using Swift with Cocoa and Objective-C (Swift 3 beta)".

Table of Contents

Getting Started

Basic Setup

  1. What is the minimum deployment target for an app made with Swift 3.0/Xcode 8?

    Answer:

    iOS 7 or OS X 10.9. Setting an earlier deployment target results in a build failure.

  2. Does Swift executables built from the command line have the runtime statically linked?

    Answer:

    No, if you plan to ship a Swift executable built from the command line, you'll need to ship the Swift dynamic libraries as well.

Understanding the Swift Import Process

  1. Which Objective-C frameworks and C libraries can be imported into Swift and how?

    Answer:

    Any framework or library that supports modules can be imported. This includes all of the Objective-C system frameworks. It can be imported simply by adding import statement to top of the file:

    import Foundation
  2. How to import C++ code into Swift?

    Answer:

    It isn't possible to import C++ code directly into Swift. Instead you need to create an Objective-C or C wrapper for C++ code.

Interoperability

Initialization

  1. Let's say you have an Objective-C class Person with initializer listed in a code below. This class imported into Swift code. How do you instantiate this Person in Swift?

    - (instancetype)initWithName:(NSString *)name age:(NSInteger)age;
    Answer:
    let bob: Person = Person(name: "Bob Novado", age: 40)
    // or you can omit the type and let Swift to infer it
    let bob = Person(name: "Bob Novado", age: 40)    
  2. How does Objective-C class factory methods imported into Swift?

    Answer:

    They imported as convinience initializers, like:

    let color = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 0.5)
    // instead of [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.5]

uswcao-quiz's People

Contributors

squatchus avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.