0

So I'm attempting a two part operation:

    var listToMail = ""

    func steps (task: NSManagedObject) {
        let taskName = task.valueForKey("name") as? String
        let taskDesc = task.valueForKey("desc") as? String

        listToMail += taskName!
        listToMail += "\n"
        listToMail += taskDesc!
        listToMail += "\n \n"
    }

    if curList == "TodayTask" || curList == "TomTask" {
        for i in (0..<taskList_Cntxt.count) {
            //Grab a Today task item
            let taskToAdd = taskList_Cntxt[i]
            steps(taskToAdd)
        }
    }

Above is step one. It works well for cycling through my CoreData list and turning the CoreData list into one string. However, I'd like the 'taskName" parts to be a larger font and bold. Is this possible?

Part 2 - Sharing It

I already have a message button that triggers a working message View Controller. It receives the list created above and passes it to be displayed in a new message. Below are the two most relevant lines, the one creating the let and the one passing it to the message VC:

    list = shareStuff.turnList_IntoString(currentListEntity)

    let messageComposeViewController = configuredMessageViewController(listName!, detail: list)

My question is, once I figure out how to attribute the text, will the message View Controller accept attributed text and show it in the message?

Dave G
  • 12,042
  • 7
  • 57
  • 83
  • You can do this by splitting your listToMail string into NSAttributedString objects. See the two top answers in the following thread: http://stackoverflow.com/questions/24666515/how-do-i-make-an-attributed-string-using-swift . Specifically, see Suragch:s detailed answer. – dfrib Dec 25 '15 at 11:52
  • That's funny. I was just trying that. I turned all those string variables into attributed strings but then I couldn't figure out how to do line breaks (it wasn't accepting "\n" and I realized I wasn't sure if the message/mail VCs would even show it if I successfully did it. – Dave G Dec 25 '15 at 11:57

0 Answers0