Giter Site home page Giter Site logo

vaierika / swiftonsundays Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 17.78 MB

Apps, games and editors for iOS & macOS written in Swift. Projects are based on materials from P. Hudson.

Swift 100.00%
swiftui uikit ios ios-development paul-hudson swift

swiftonsundays's Introduction

Swift on Sundays

Repo includes applications, games and editors for iOS & macOS written in Swift. Projects are based on materials from Paul Hudson.

To impove skill of integration and have some fun I will write solutions of each project in UIKit and SwiftUI versions.


Completion status

Projects UIKit SwiftUI
Memory App (iOS) + +
Inner Peace (iPad) + +
to be continued... - -

Inner Peace

Discussed topics:

  • Resizing text due to its length
  • Adding a shadow to the text (+ rendering an image)
  • Sharing the chosen quote
  • Sending notifications

Sending notifications

The same for both frameworks.

Resizing Text View with SwiftUI + shadow

Text resizing and adding a shadow tasks are quite easier with SwiftUI then with UIKit.

Text(textQuote)
    .font(.system(size: 1000))
    .minimumScaleFactor(0.01)
    .shadow(color: .black, radius: 6, x: 0, y: 3)

Issue 1. Representable for UIActivityViewController

SwiftUI library doesn't have its own view for sharing activity yet.

Solution: Use the functionality of the UIActivityViewController with a UIViewControllerRepresentable.


Memory App


Issue 1. Attributes of a String in SwiftUI

SwiftUI's Text view doesn't attributesText ๐Ÿ’”. That's why I had to use UIKit's UITextView()

Solution: Thanks to the protocol UIViewRepresentable we can present UI elements from UIKit as views. It is a bridge between two frameworks.

Issue 2. Sizes of the new-born View

A size of the new View made from UIKit cannot be recognized fast and automatically when it is used as a part of the view's body. Specially if it is inside the ScrollView(), it takes not the space it is needed.

Solution: If you need a specific size, just declare it with .frame modifier. However if the size differs and depends on the content, use a @Binding property wrapper for the height of the UIViewType. It is important to assign it in the main thread. And then use its value for a .frame modifier.



Note

Since I am fascinated by SwiftUI and at the same time I understand an influence UIKit, I wrote projects by Paul Hudson in both frameworks . I'd appreciate any features and improvement you have to share. Feel free to reach me out ๐Ÿ˜Š


swiftonsundays's People

Contributors

vaierika avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jayisblessed

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.