• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

appbrewery/Xylophone-iOS13: Learn to Code While Building Apps - The Complete iOS ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

appbrewery/Xylophone-iOS13

开源软件地址:

https://github.com/appbrewery/Xylophone-iOS13

开源编程语言:

Swift 100.0%

开源软件介绍:

App Brewery Banner

Xylophone

Our Goal

The goal of this tutorial is to dive into a simple iOS recipe - how to play sound and use an Apple library called AVFoundation. The most important skill of a great programmer is being able to solve your own problems. We’ll do that by exploring StackOverflow, Apple Documentation and learning how to search for solutions effectively. By learning to use these tools, you’ll be able to start adding custom features to an app and get it to do what you want it to.

What you will create

You will be making your first musical instrument! Music apps are so popular on the App Store that they even get their own category. So in this module, we’re going to make a colourful XyloPhone app. Get it? Ok, the jokes are bad, but remember, I only wrote the good ones...

What you will learn

  • How to play sound using AVFoundation and AVAudioPlayer.
  • Understand Apple documentation and how to use StackOverflow.
  • Functions and methods in Swift.
  • Data types.
  • Swift loops.
  • Variable scope.
  • The ViewController lifecycle.
  • Error handling in Swift.
  • Code refactoring.
  • Basic debugging.

Replacement Code

import UIKit
import AVFoundation

class ViewController: UIViewController {
    
    var player: AVAudioPlayer!

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func keyPressed(_ sender: UIButton) {
        playSound()
    }
    
    func playSound() {
        let url = Bundle.main.url(forResource: "C", withExtension: "wav")
        player = try! AVAudioPlayer(contentsOf: url!)
        player.play()
                
    }
}

This is a companion project to The App Brewery's Complete App Development Bootcamp, check out the full course at www.appbrewery.co

End Banner




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
zweigraf/face-landmarking-ios: 发布时间:2022-06-23
下一篇:
huri000/SwiftEntryKit: SwiftEntryKit is a presentation library for iOS. It can b ...发布时间:2022-06-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap