Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

Swift Programming

Swift is a compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code ("safer") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program. A second free implementation of Swift targets Microsoft's Common Language Infrastructure (a.k.a. .NET) and the Java/Android platform.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi, I would like to write a Swift iOS application and one of the features it has to employ is that I would need to pair an iPhone with an iPad via Bluetooth.

I would use the iPhone to control the way a text file is displayed on the iPad. In other words, if I wanted to scroll the text file downwards on the iPad, I would push a button on the iPhone. If I wanted to scroll the text file upwards, I would push another button on the iPhone. If I wanted to page-up or down on the iPad's text file, I would use other buttons on the iPhone. The iPhone would control the way the text file is displayed on the iPad.

Does anyone have a good example or tutorial that could guide me in the features I've described above?

Ultimately, there would be two iOS Apps, one on the iPhone and one on the iPad and they would be paired via Bluetooth to connect the two devices making one responsive to the other.  

Thank you,
Fulano
0
On Demand Webinar: Networking for the Cloud Era
LVL 10
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Hi, I have a UIPickerView with 2 images in each row, I would like to animate one of the images when it is selected ...I have been able to animate the whole pickerview when the selection changes (in didSelectRow), but I want to just animate one of the images

with the code below ...in the didSelectRow function how would I reference the selected "firstImage" image to apply the animation?

Instead of memoryPicker.transform I've tried...

pickerView.firstImage.transform -  which gives error: Value of type 'UIPickerView' has no member 'firstImage'
And
view.firstimage.transform -  gives error: Value of type 'UIView' has no member 'firstImage'
Thanks

[code]@IBOutlet weak var memoryPicker: UIPickerView!

func numberOfComponents(in pickerView: UIPickerView) -> Int {
    return 1
}

// The number of rows of data
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {

    return objectsToRemember.count
}

func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
    return 100
}

func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView {

    let view = UIView(frame: CGRect(x: 0, y:0, width: 250, height: 100))

    let firstImage = UIImageView()
        firstImage.image = UIImage(named:objectsToRemember[row])
        firstImage.frame = CGRect(x: 0, y: 0, width: 100, height: 100)

    let secondImage = …
0
I am trying to run code in swift when a textField (in macOS) changes. I have tried:

    override func viewDidLoad() {
        super.viewDidLoad()

        let name = "NSNotificationTextFieldChanged"
        NotificationCenter.default.addObserver(self, selector: Selector(fieldTextDidChange),
            Notification(name: Notification.Name(rawValue: name)), object: nil)
       
    }
   
    func fieldTextDidChange(notification: NSNotification) {
        errorMessage.stringValue = ""
        errorMessage.isHidden = true
    }

but I get the error "Cannot convert value of type '(NSNotification) -> ()' to expected argument type 'String'

Any ideas?
0

Swift Programming

Swift is a compiled programming language created for iOS, OS X, watchOS, tvOS and Linux development by Apple Inc. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products. Swift is intended to be more resilient to erroneous code ("safer") than Objective-C and also more concise. It is built with the LLVM compiler framework included in Xcode 6 and later and uses the Objective-C runtime, which allows C, Objective-C, C++ and Swift code to run within a single program. A second free implementation of Swift targets Microsoft's Common Language Infrastructure (a.k.a. .NET) and the Java/Android platform.

Top Experts In
Swift Programming
<
Monthly
>